public function filter(RouteCollection $collection, Request $request): RouteCollection
    {
        $languages = $request->getLanguages();

        foreach ($collection->all() as $name => $route) {
            if ('.fallback' !== substr($name, -9) && ($this->prependLocale || '.root' !== substr($name, -5))) {
                continue;
            }

            /** @var PageModel $pageModel */
            $pageModel = $route->getDefault('pageModel');

            if (
                !$pageModel instanceof PageModel
                || $pageModel->rootIsFallback
                || \in_array($pageModel->rootLanguage, $languages, true)
                || preg_grep('/'.preg_quote($pageModel->rootLanguage, '/').'_[A-Z]{2}/', $languages)
            ) {
                continue;
            }

            $collection->remove($name);
        }

        return $collection;
    }
public function filter(RouteCollection $collection, Request $request): RouteCollection
    {
        $languages = $request->getLanguages();

        foreach ($collection->all() as $name => $route) {
            if ('.fallback' !== substr($name, -9) && ($this->prependLocale || '.root' !== substr($name, -5))) {
                continue;
            }

            
            $pageModel = $route->getDefault('pageModel');

            if (
                !$pageModel instanceof PageModel
                || $pageModel->rootIsFallback
                || \in_array($pageModel->rootLanguage, $languages, true)
                || preg_grep('/'.preg_quote($pageModel->rootLanguage, '/').'_[A-Z]{2}/', $languages)
            ) {
                continue;
            }

            $collection->remove($name);
        }

        return $collection;
    }
public function filter ( RouteCollection $ collection , Request $ request ) : RouteCollection { $ languages = $ request -> getLanguages ( ) ; foreach ( $ collection -> all ( ) as $ name => $ route ) { if ( '.fallback' !== substr ( $ name , - 9 ) && ( $ this -> prependLocale || '.root' !== substr ( $ name , - 5 ) ) ) { continue ; } /** @var PageModel $pageModel */ $ pageModel = $ route -> getDefault ( 'pageModel' ) ; if ( ! $ pageModel instanceof PageModel || $ pageModel -> rootIsFallback || \ in_array ( $ pageModel -> rootLanguage , $ languages , true ) || preg_grep ( '/' . preg_quote ( $ pageModel -> rootLanguage , '/' ) . '_[A-Z]{2}/' , $ languages ) ) { continue ; } $ collection -> remove ( $ name ) ; } return $ collection ; }
{@inheritdoc}
{