public function processUpdate(array $data)
	{
		$set = $this->formatCmd('set');

		$data[$set] = isset($data[$set]) ? $data[$set] : [];

		foreach ($data as $index => $value) {

			if (substr($index, 0, 1) !== $this->cmd) {
				$data[$set][$index] = $value;
				unset($data[$index]);
				continue;
			}

			$ckey = substr($index, 1);

			if ($ckey === 'unset') {
				$data[$index] = array_fill_keys(array_values((array) $value), '');
			} elseif (in_array($ckey, ['setOnInsert', 'addToSet', 'push'])) {
				$data[$index] = $this->processData($value);
			}
		}

		if (empty($data[$set])) {
			unset($data[$set]);
		} else {
			$data[$set] = $this->processData($data[$set]);
		}

		return $data;
	}
public function processUpdate(array $data)
	{
		$set = $this->formatCmd('set');

		$data[$set] = isset($data[$set]) ? $data[$set] : [];

		foreach ($data as $index => $value) {

			if (substr($index, 0, 1) !== $this->cmd) {
				$data[$set][$index] = $value;
				unset($data[$index]);
				continue;
			}

			$ckey = substr($index, 1);

			if ($ckey === 'unset') {
				$data[$index] = array_fill_keys(array_values((array) $value), '');
			} elseif (in_array($ckey, ['setOnInsert', 'addToSet', 'push'])) {
				$data[$index] = $this->processData($value);
			}
		}

		if (empty($data[$set])) {
			unset($data[$set]);
		} else {
			$data[$set] = $this->processData($data[$set]);
		}

		return $data;
	}
public function processUpdate ( array $ data ) { $ set = $ this -> formatCmd ( 'set' ) ; $ data [ $ set ] = isset ( $ data [ $ set ] ) ? $ data [ $ set ] : [ ] ; foreach ( $ data as $ index => $ value ) { if ( substr ( $ index , 0 , 1 ) !== $ this -> cmd ) { $ data [ $ set ] [ $ index ] = $ value ; unset ( $ data [ $ index ] ) ; continue ; } $ ckey = substr ( $ index , 1 ) ; if ( $ ckey === 'unset' ) { $ data [ $ index ] = array_fill_keys ( array_values ( ( array ) $ value ) , '' ) ; } elseif ( in_array ( $ ckey , [ 'setOnInsert' , 'addToSet' , 'push' ] ) ) { $ data [ $ index ] = $ this -> processData ( $ value ) ; } } if ( empty ( $ data [ $ set ] ) ) { unset ( $ data [ $ set ] ) ; } else { $ data [ $ set ] = $ this -> processData ( $ data [ $ set ] ) ; } return $ data ; }
Process update data
@param array ['a' => 1, 'b%s' => 2, '$set' => ['c%i' => '3'], '$unset' => ['d', 'e'], ...]
@return array ['$set' => ['a' => 1, 'b' => '2', 'c' => 3], '$unset' => ['d' => '', 'e' => ''], ...]
Process update data