Filtering in route

@param  RouteInterface $route
@param  RequestInterface $request
@return bool
@access protected
763018
protected function filtering(
        RouteInterface $route,
        RequestInterface $request
    ) {
        foreach ($route->getFilters() as $field => $filter) {
            list($grpName, $keyName) = explode('.', $field, 2);
            switch ($grpName) {
                case 'session':
                    $against = isset($_SESSION[$keyName]) ?
                        $_SESSION[$keyName] : '';
                    break;
                case 'cookie':
                    $against = isset($_COOKIE[$keyName]) ?
                        $_COOKIE[$keyName] : '';
                    break;
                case 'request':
                    $against = $request->getRequestInfo($keyName);
                    break;
                default:
                    $against = $request->getServerInfo($keyName);
                    break;
            }

            if (is_callable($filter)) {
                return $filter((string) $against);
            } elseif (!preg_match('~'.$filter.'~x', (string) $against)) {
                return false;
            }
        }
        return true;
    }
945634
public function resolve(RouteInterface $route)
    {
        if (is_string($handler = $route->handler()))
        {
            $handler = explode('@', $handler);
        }

        $parameters = (array) $route->parameters();

        list($handler, $reflection) = $this->reflection($handler);

        $parameters = $this->arguments($reflection, $parameters);

        return call_user_func_array($handler, $parameters);
    }
1049281
public function applyFilters(IRoute $route) {
        foreach ($this->getFilters() as $filter) {
            if ($filter->isEnabled()) {
                $invoker = $this->getFilterInvoker();
                $result = $invoker->invoke($filter->getFilter(), $route);

                if (is_bool($result)) {
                    return $result;
                }
            }
        }

        return true;
    }
823394
protected function runRouteWithinStack(Route $route, Request $request)
    {
        $skipMiddleware = $this->container->bound('middleware.disable') &&
                          ($this->container->make('middleware.disable') === true);

        // Create a Pipeline instance.
        $pipeline = new Pipeline(
            $this->container, $skipMiddleware ? array() : $this->gatherRouteMiddleware($route)
        );

        return $pipeline->handle($request, function ($request) use ($route)
        {
            $response = $route->run($request);

            return $this->prepareResponse($request, $response);
        });
    }
1090233
protected function runRouteWithinStack(Route $route, Request $request)
    {
        $shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
                                $this->container->make('middleware.disable') === true;

        $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);

        return (new Pipeline($this->container))
                        ->send($request)
                        ->through($middleware)
                        ->then(function ($request) use ($route) {
                            return $this->prepareResponse(
                                $request, $route->run()
                            );
                        });
    }
454544
public function setRoute(RouteInterface $route): RouterInterface
    {
        $regexp = $route->getRegexp();
        $this->_routes[$regexp] = $route;
        return $this;
    }
727204
public function matchRoute($userId, $route)
    {
        $groups = $this->getRouteTable($userId, $route);
        
        if (is_array($groups) && count($groups) > 0) {
            return true;
        }

        return false;
    }
157158
public static function checkRoute($userId, $route)
    {
        $routes = static::getRoutesByUser($userId);
        $route = '/' . ltrim($route, '/');
        if (isset($routes[$route])) {
            return true;
        }
        while (($pos = strrpos($route, '/')) > 0) {
            $route = substr($route, 0, $pos);
            if (isset($routes[$route . '/*'])) {
                return true;
            }
        }
        return isset($routes['/*']);
    }
238256
function match(RequestInterface $request)
    {
        ## host may have port
        /** @var RequestInterface $request */
        $host = $request->getHeaderLine('Host');
        if (! $host )
            throw new \Exception('Host not recognized in Request.');

        $criteria   = $this->getCriteria();
        $parts      = \Poirot\Std\Lexer\parseCriteria($criteria, '.');
        $regexMatch = \Poirot\Std\Lexer\buildRegexFromParsed($parts);
        $result     = preg_match('(^' . $regexMatch . '$)', $host, $matches);


        if (! $result )
            ## route not matched
            return false;

        ## merge match params definition:
        $params = array();
        foreach ($matches as $index => $val) {
            if (is_int($index)) continue;

            $params[$index] = $val;
        }

        $routerMatch = clone $this;
        if (! empty($params))
            \Poirot\Router\mergeParamsIntoRouter($routerMatch, $params);

        return $routerMatch;
    }
1120816
public function isAllowed(RequestInterface $uri)
    {
        foreach ($this->guards as $guard) {
            if (!$guard->isAllowed($uri)) {
                return false;
            }
        }
        return true;
    }
621957
public function track(Route $route, Request $request)
    {
        return $this->trackRoutePath(
            $route, $request, $this->trackRoute($route)
        );
    }
671946
private function getRouteProtocol(RouteInterface $route, RequestContextInterface $request)
    {
        $requestScheme = $request->getScheme();

        $schemes = $route->getSchemes();

        if (in_array($requestScheme, $schemes)) {
            return $requestScheme;
        }

        return current($schemes) ?: 'http';
    }
664794
protected function processing(RequestInterface $request)
    {
        $key = sprintf(
            '%s?%s',
            $request->getUri()->getPath(),
            $request->getUri()->getQuery()
        );

        if ($request->getMethod() == 'GET' && isset($this->data[$key])) {
            return $this->data[$key];
        }

        return null;
    }
174505
protected function runRoute(Request $request, Route $route)
    {
        $request->setRouteResolver(function () use ($route) {
            return $route;
        });

        $this->events->dispatch(new Events\RouteMatched($route, $request));

        return $this->prepareResponse($request,
            $this->runRouteWithinStack($route, $request)
        );
    }
574043
protected function routeCanBeShown($route): bool
    {
        return ($route->canBeShown() && $route->getRoutable()->canBeShown() || $this->gate->allows('viewInactive', $route));
    }
869011
public function matchRequest(\TYPO3\Flow\Mvc\RequestInterface $request) {
		/** @var \TYPO3\Flow\Security\RequestPatternInterface $pattern */
		foreach ($this->subPatterns as $pattern) {
			if ($pattern->matchRequest($request) === FALSE) {
				return FALSE;
			}
		}

		return TRUE;
	}
953940
protected function getRouteMatch(RequestInterface $request) : Match
	{
		/** @var Router $router */
		$router = $this->dependencyContainer->get('fuel.application.router');
		$match = $router->translate($request->getUri()->getPath(), $request->getMethod());

		return $match;
	}