public function filter(RouteCollection $collection, Request $request): RouteCollection
    {
        if ($this->tokenChecker->hasBackendUser() && $this->tokenChecker->isPreviewMode()) {
            return $collection;
        }

        foreach ($collection->all() as $name => $route) {
            /** @var PageModel $pageModel */
            $pageModel = $route->getDefault('pageModel');

            if (!$pageModel instanceof PageModel || $pageModel->rootIsPublic) {
                continue;
            }

            $collection->remove($name);
        }

        return $collection;
    }
public function filter(RouteCollection $collection, Request $request): RouteCollection
    {
        if ($this->tokenChecker->hasBackendUser() && $this->tokenChecker->isPreviewMode()) {
            return $collection;
        }

        foreach ($collection->all() as $name => $route) {
            
            $pageModel = $route->getDefault('pageModel');

            if (!$pageModel instanceof PageModel || $pageModel->rootIsPublic) {
                continue;
            }

            $collection->remove($name);
        }

        return $collection;
    }
public function filter ( RouteCollection $ collection , Request $ request ) : RouteCollection { if ( $ this -> tokenChecker -> hasBackendUser ( ) && $ this -> tokenChecker -> isPreviewMode ( ) ) { return $ collection ; } foreach ( $ collection -> all ( ) as $ name => $ route ) { /** @var PageModel $pageModel */ $ pageModel = $ route -> getDefault ( 'pageModel' ) ; if ( ! $ pageModel instanceof PageModel || $ pageModel -> rootIsPublic ) { continue ; } $ collection -> remove ( $ name ) ; } return $ collection ; }
{@inheritdoc}
{