public function process(ExprBuilder $builder, $field, $expression, $value)
    {
        if (!Expr::isValidExpression($expression)) {
            throw new ParserException(sprintf(
                'The expression "%s" is not allowed or not exists.',
                $expression
            ));
        }

        switch ($expression) {
            case 'between':
                set_error_handler(function () use ($value) {
                    throw new ParserException(sprintf(
                        'The value of "between" expression "%s" is not valid.',
                        $value
                    ));
                });

                list($from, $to) = explode('-', $value);

                restore_error_handler();

                return $builder->between($field, $from, $to);
            case 'paginate':
                set_error_handler(function () use ($value) {
                    throw new ParserException(sprintf(
                        'The value of "paginate" expression "%s" is not valid.',
                        $value
                    ));
                });

                list($currentPageNumber, $maxResultsPerPage) = explode('-', $value);

                restore_error_handler();

                return $builder->paginate($currentPageNumber, $maxResultsPerPage);
            case 'or':
                return $builder->orx($value);
            default:
                return $builder->{$expression}($field, $value);
        }
    }
public function process(ExprBuilder $builder, $field, $expression, $value)
    {
        if (!Expr::isValidExpression($expression)) {
            throw new ParserException(sprintf(
                'The expression "%s" is not allowed or not exists.',
                $expression
            ));
        }

        switch ($expression) {
            case 'between':
                set_error_handler(function () use ($value) {
                    throw new ParserException(sprintf(
                        'The value of "between" expression "%s" is not valid.',
                        $value
                    ));
                });

                list($from, $to) = explode('-', $value);

                restore_error_handler();

                return $builder->between($field, $from, $to);
            case 'paginate':
                set_error_handler(function () use ($value) {
                    throw new ParserException(sprintf(
                        'The value of "paginate" expression "%s" is not valid.',
                        $value
                    ));
                });

                list($currentPageNumber, $maxResultsPerPage) = explode('-', $value);

                restore_error_handler();

                return $builder->paginate($currentPageNumber, $maxResultsPerPage);
            case 'or':
                return $builder->orx($value);
            default:
                return $builder->{$expression}($field, $value);
        }
    }
public function process ( ExprBuilder $ builder , $ field , $ expression , $ value ) { if ( ! Expr :: isValidExpression ( $ expression ) ) { throw new ParserException ( sprintf ( 'The expression "%s" is not allowed or not exists.' , $ expression ) ) ; } switch ( $ expression ) { case 'between' : set_error_handler ( function ( ) use ( $ value ) { throw new ParserException ( sprintf ( 'The value of "between" expression "%s" is not valid.' , $ value ) ) ; } ) ; list ( $ from , $ to ) = explode ( '-' , $ value ) ; restore_error_handler ( ) ; return $ builder -> between ( $ field , $ from , $ to ) ; case 'paginate' : set_error_handler ( function ( ) use ( $ value ) { throw new ParserException ( sprintf ( 'The value of "paginate" expression "%s" is not valid.' , $ value ) ) ; } ) ; list ( $ currentPageNumber , $ maxResultsPerPage ) = explode ( '-' , $ value ) ; restore_error_handler ( ) ; return $ builder -> paginate ( $ currentPageNumber , $ maxResultsPerPage ) ; case 'or' : return $ builder -> orx ( $ value ) ; default : return $ builder -> { $ expression } ( $ field , $ value ) ; } }
Process one expression an enqueue it using the ExprBuilder instance.

@param  ExprBuilder $builder
@param  string      $field
@param  string      $expression
@param  string      $value

@return ExprBuilder

@throws ParserException
Process one expression an enqueue it using the ExprBuilder instance .