public static function filter(Request $request)
    {
        $bags = MutableBag::from(array_fill_keys(['attributes', 'query', 'files', 'cookies', 'headers', 'server'], null));
        foreach ($bags->keys() as $key) {
            $bags[$key] = static::getValues($request->$key->all());
        }
        if ($request->hasSession()) {
            $bags['session'] = static::getValues($request->getSession()->all());
        }

        return $bags->immutable();
    }
public static function filter(Request $request)
    {
        $bags = MutableBag::from(array_fill_keys(['attributes', 'query', 'files', 'cookies', 'headers', 'server'], null));
        foreach ($bags->keys() as $key) {
            $bags[$key] = static::getValues($request->$key->all());
        }
        if ($request->hasSession()) {
            $bags['session'] = static::getValues($request->getSession()->all());
        }

        return $bags->immutable();
    }
public static function filter ( Request $ request ) { $ bags = MutableBag :: from ( array_fill_keys ( [ 'attributes' , 'query' , 'files' , 'cookies' , 'headers' , 'server' ] , null ) ) ; foreach ( $ bags -> keys ( ) as $ key ) { $ bags [ $ key ] = static :: getValues ( $ request -> $ key -> all ( ) ) ; } if ( $ request -> hasSession ( ) ) { $ bags [ 'session' ] = static :: getValues ( $ request -> getSession ( ) -> all ( ) ) ; } return $ bags -> immutable ( ) ; }
Filter a request object to be safe to pass to Twig.

@param Request $request

@return Bag
Filter a request object to be safe to pass to Twig .