public static function normalize($expression)
    {
        if (is_callable($expression)) {
            $expressionConfigurator = $expression;
            $expression = new Expression;
            call_user_func($expressionConfigurator, $expression);
        }

        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (is_array($expression)) {
            foreach ($expression as $fieldName => $value) {
                $expression[$fieldName] = self::normalize($value);
            }
        }

        return $expression;
    }
public static function normalize($expression)
    {
        if (is_callable($expression)) {
            $expressionConfigurator = $expression;
            $expression = new Expression;
            call_user_func($expressionConfigurator, $expression);
        }

        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (is_array($expression)) {
            foreach ($expression as $fieldName => $value) {
                $expression[$fieldName] = self::normalize($value);
            }
        }

        return $expression;
    }
public static function normalize ( $ expression ) { if ( is_callable ( $ expression ) ) { $ expressionConfigurator = $ expression ; $ expression = new Expression ; call_user_func ( $ expressionConfigurator , $ expression ) ; } if ( $ expression instanceof Expression ) { $ expression = $ expression -> toArray ( ) ; } elseif ( is_array ( $ expression ) ) { foreach ( $ expression as $ fieldName => $ value ) { $ expression [ $ fieldName ] = self :: normalize ( $ value ) ; } } return $ expression ; }
Convert expression specified in different formats to canonical form

@param Expression|callable $expression
@return array
Convert expression specified in different formats to canonical form