tests/UnitTests/POData/UriProcessor/QueryProcessor/ExpressionParser/PHPExpressionProviderTest.php
/**
     * Parse the astoria filter expression, generate the same expression as PHP expression,
     * retrieve only the entries which satisfies this expression.
     * 
     * @param string         $astoriaFilter
     * @param ResourceType    $resourceType
     * @param array<objects> $entries
     * 
     * @return array<objects>
     */
Parse the astoria filter expression, generate the same expression as PHP expression,
retrieve only the entries which satisfies this expression.



@return array
Parse the astoria filter expression generate the same expression as PHP expression retrieve only the entries which satisfies this expression . @return array
private function executeExpression($astoriaFilter, $resourceType, $entries)
    {
        $parser = new ExpressionParser2($astoriaFilter, $resourceType, true);
        $expressionTree = $parser->parseFilter();
        $expressionProcessor = new ExpressionProcessor(new \POData\Providers\Expression\PHPExpressionProvider('$lt'));
        $phpExpression = $expressionProcessor->processExpression($expressionTree);
        $fun = create_function('$lt', 'if(' . $phpExpression . ') { return true; } else { return false;}');
        $result = array();
        foreach($entries as $lt) {
            if($fun($lt)) {
               $result[] = $lt;
            }
        }
        return $result;
    }
private function executeExpression ( $ astoriaFilter , $ resourceType , $ entries ) { $ parser = new ExpressionParser2 ( $ astoriaFilter , $ resourceType , true ) ; $ expressionTree = $ parser -> parseFilter ( ) ; $ expressionProcessor = new ExpressionProcessor ( new \ POData \ Providers \ Expression \ PHPExpressionProvider ( '$lt' ) ) ; $ phpExpression = $ expressionProcessor -> processExpression ( $ expressionTree ) ; $ fun = create_function ( '$lt' , 'if(' . $ phpExpression . ') { return true; } else { return false;}' ) ; $ result = array ( ) ; foreach ( $ entries as $ lt ) { if ( $ fun ( $ lt ) ) { $ result [ ] = $ lt ; } } return $ result ; }
Parse the astoria filter expression, generate the same expression as PHP expression,
 retrieve only the entries which satisfies this expression.
Parse the astoria filter expression generate the same expression as PHP expression retrieve only the entries which satisfies this expression .
//Parse the Astoria filter query option to expression tree //emit the PHP expression corresponds to Astoria filter query //create an anonymous function with the generated PHP expression in if condition //Filter out only the entries which satisfies the condition