src/Formatter.php
private function formatQueryExpression(array $expression, Closure $converter)
    {
        foreach ($expression as $key => $value) {

            if ('$regex' === $key && !$value instanceof \MongoRegex) {
                $expression[$key] = new \MongoRegex($value);
                continue;
            }

            if (true === $this->isOpType('ignore', $key)) {
                continue;
            }

            if (true === $this->isOpType('single', $key)) {
                $expression[$key] = $converter($value);
                continue;
            }

            if (true === $this->isOpType('multiple', $key)) {
                $value = (array) $value;
                foreach ($value as $subKey => $subValue) {
                    $expression[$key][$subKey] = $converter($subValue);
                }
                continue;
            }

            if (true === $this->isOpType('recursive', $key)) {
                $value = (array) $value;
                $expression[$key] = $this->formatQueryExpression($value, $converter);
                continue;
            }

            $expression[$key] = $converter($value);
        }
        return $expression;
    }
private function formatQueryExpression(array $expression, Closure $converter)
    {
        foreach ($expression as $key => $value) {

            if ('$regex' === $key && !$value instanceof \MongoRegex) {
                $expression[$key] = new \MongoRegex($value);
                continue;
            }

            if (true === $this->isOpType('ignore', $key)) {
                continue;
            }

            if (true === $this->isOpType('single', $key)) {
                $expression[$key] = $converter($value);
                continue;
            }

            if (true === $this->isOpType('multiple', $key)) {
                $value = (array) $value;
                foreach ($value as $subKey => $subValue) {
                    $expression[$key][$subKey] = $converter($subValue);
                }
                continue;
            }

            if (true === $this->isOpType('recursive', $key)) {
                $value = (array) $value;
                $expression[$key] = $this->formatQueryExpression($value, $converter);
                continue;
            }

            $expression[$key] = $converter($value);
        }
        return $expression;
    }
private function formatQueryExpression ( array $ expression , Closure $ converter ) { foreach ( $ expression as $ key => $ value ) { if ( '$regex' === $ key && ! $ value instanceof \ MongoRegex ) { $ expression [ $ key ] = new \ MongoRegex ( $ value ) ; continue ; } if ( true === $ this -> isOpType ( 'ignore' , $ key ) ) { continue ; } if ( true === $ this -> isOpType ( 'single' , $ key ) ) { $ expression [ $ key ] = $ converter ( $ value ) ; continue ; } if ( true === $ this -> isOpType ( 'multiple' , $ key ) ) { $ value = ( array ) $ value ; foreach ( $ value as $ subKey => $ subValue ) { $ expression [ $ key ] [ $ subKey ] = $ converter ( $ subValue ) ; } continue ; } if ( true === $ this -> isOpType ( 'recursive' , $ key ) ) { $ value = ( array ) $ value ; $ expression [ $ key ] = $ this -> formatQueryExpression ( $ value , $ converter ) ; continue ; } $ expression [ $ key ] = $ converter ( $ value ) ; } return $ expression ; }
Formats a query expression.

@param   array   $expression
@param   Closure $converter
@return  array
Formats a query expression .