private function createMapFunction()
    {
        return new ExpressionFunction(
            'map',
            function ($elements, $expression) {
                throw new \Exception('Map function does not support compilation');
            },
            function (array $values, $elements, $expression) {
                if (empty($elements)) {
                    return [];
                }

                $result = [];

                foreach ($elements as $element) {
                    $result[] = $this->evaluate($expression, [
                        'el' => $element,
                    ]);
                }

                return $result;
            }
        );
    }
private function createMapFunction()
    {
        return new ExpressionFunction(
            'map',
            function ($elements, $expression) {
                throw new \Exception('Map function does not support compilation');
            },
            function (array $values, $elements, $expression) {
                if (empty($elements)) {
                    return [];
                }

                $result = [];

                foreach ($elements as $element) {
                    $result[] = $this->evaluate($expression, [
                        'el' => $element,
                    ]);
                }

                return $result;
            }
        );
    }
private function createMapFunction ( ) { return new ExpressionFunction ( 'map' , function ( $ elements , $ expression ) { throw new \ Exception ( 'Map function does not support compilation' ) ; } , function ( array $ values , $ elements , $ expression ) { if ( empty ( $ elements ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ elements as $ element ) { $ result [ ] = $ this -> evaluate ( $ expression , [ 'el' => $ element , ] ) ; } return $ result ; } ) ; }
Map is an analogue for array_map. The callback
in the form of an expression. The nested expression has
one variable, "el".

For example:

map({'foo': 'one', 'foo': 'two'}, 'el["foo"]'}) = array('one', 'two');

@return ExpressionFunction
Map is an analogue for array_map . The callback in the form of an expression . The nested expression has one variable el .