public function processCondition(array $conditions, $depth = 0)
	{
		if (empty($conditions)) {
			return [];
		}

		$parsed = [];

		foreach ($conditions as $key => $condition) {
			if (is_int($key)) {
				if ($depth > 0 && is_array($condition)) {
					throw new InvalidArgumentException('Too deep sets of condition!');
				}
				if (is_array($condition)) {
					$parsed = array_merge($parsed, $this->processCondition($condition, $depth + 1));
				} else {
					$parsed[] = $this->parseCondition($condition);
				}
			} else {
				$parsed[] = $this->parseCondition($key, $condition);
			}
		}

		return $depth > 0 ? $parsed : (count($parsed) > 1 ? [$this->formatCmd('and') => $parsed] : $parsed[0]);
	}
public function processCondition(array $conditions, $depth = 0)
	{
		if (empty($conditions)) {
			return [];
		}

		$parsed = [];

		foreach ($conditions as $key => $condition) {
			if (is_int($key)) {
				if ($depth > 0 && is_array($condition)) {
					throw new InvalidArgumentException('Too deep sets of condition!');
				}
				if (is_array($condition)) {
					$parsed = array_merge($parsed, $this->processCondition($condition, $depth + 1));
				} else {
					$parsed[] = $this->parseCondition($condition);
				}
			} else {
				$parsed[] = $this->parseCondition($key, $condition);
			}
		}

		return $depth > 0 ? $parsed : (count($parsed) > 1 ? [$this->formatCmd('and') => $parsed] : $parsed[0]);
	}
public function processCondition ( array $ conditions , $ depth = 0 ) { if ( empty ( $ conditions ) ) { return [ ] ; } $ parsed = [ ] ; foreach ( $ conditions as $ key => $ condition ) { if ( is_int ( $ key ) ) { if ( $ depth > 0 && is_array ( $ condition ) ) { throw new InvalidArgumentException ( 'Too deep sets of condition!' ) ; } if ( is_array ( $ condition ) ) { $ parsed = array_merge ( $ parsed , $ this -> processCondition ( $ condition , $ depth + 1 ) ) ; } else { $ parsed [ ] = $ this -> parseCondition ( $ condition ) ; } } else { $ parsed [ ] = $ this -> parseCondition ( $ key , $ condition ) ; } } return $ depth > 0 ? $ parsed : ( count ( $ parsed ) > 1 ? [ $ this -> formatCmd ( 'and' ) => $ parsed ] : $ parsed [ 0 ] ) ; }
Process sets of conditions and merges them by AND operator
@param array in format [['a' => 1], ['b IN' => [1, 2]], [...]] or ['a' => 1, 'b IN' => [1, 2], ...]
@param array single condition ['a' => 1] or multiple condition ['$and' => ['a' => 1, 'b' => ['$in' => [1, 2]]], ...]
Process sets of conditions and merges them by AND operator