src/Sulu/Component/Util/ArrayUtils.php
public static function filter(array $collection, $expression, array $context = [])
    {
        $language = new ExpressionLanguage();

        $result = [];
        foreach ($collection as $key => $item) {
            if ($language->evaluate($expression, array_merge($context, ['item' => $item, 'key' => $key]))) {
                $result[$key] = $item;
            }
        }

        return $result;
    }
public static function filter(array $collection, $expression, array $context = [])
    {
        $language = new ExpressionLanguage();

        $result = [];
        foreach ($collection as $key => $item) {
            if ($language->evaluate($expression, array_merge($context, ['item' => $item, 'key' => $key]))) {
                $result[$key] = $item;
            }
        }

        return $result;
    }
public static function filter ( array $ collection , $ expression , array $ context = [ ] ) { $ language = new ExpressionLanguage ( ) ; $ result = [ ] ; foreach ( $ collection as $ key => $ item ) { if ( $ language -> evaluate ( $ expression , array_merge ( $ context , [ 'item' => $ item , 'key' => $ key ] ) ) ) { $ result [ $ key ] = $ item ; } } return $ result ; }
Filter array with given symfony-expression.

@param array $collection
@param string $expression
@param array $context

@return array
Filter array with given symfony - expression .