Check if any of routes doesn't match

@access  private
@return  \Lollipop\HTTP\Response
6764
static private function _getDefaultPageNotFound() {
        return [
            'path' => '404',
            'callback' => function(\Lollipop\HTTP\Request $req, \Lollipop\HTTP\Response $res, $args = []) {
                // Create a default 404 page
                $pagenotfound = '<!DOCTYPE html>'
                        . '<!-- Lollipop for PHP by John Aldrich Bernardo -->'
                        . '<html>'
                        . '<head><title>404 Not Found</title></head>'
                        . '<meta name="viewport" content="width=device-width, initial-scale=1">'
                        . '<body>'
                        . '<h1>404 Not Found</h1>'
                        . '<p>The page that you have requested could not be found.</p>'
                        . '</body>'
                        . '</html>';
        
                // Create a new 404 Page Not Found Response
                $response = new Response($pagenotfound);
                // Set header for 404
                $response->header('HTTP/1.0 404 Not Found');
        
                // Execute
                return $response;
            },
            'arguments' => []
        ];
    }
743433
protected function isResponseOk()
    {
        $status = $this->rawResponse->status;
        if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
            return true;
        }
        return false;
    }
743159
public function check() {
        if ($this->_checkCsrf() == true) {
            switch ($this->request->logged) {
                case '*' :
                    return true;
                    break;

                case 'true' :
                    if ($this->_checkLogged()) {
                        if ($this->_checkRole()) {
                            return true;
                        }
                        else {
                            $t = new Template($this->_configFirewall['forbidden']['template'], 'gcsfirewall', 0);
                            foreach ($this->_configFirewall['forbidden']['variable'] as $val) {
                                if ($val['type'] == 'var') {
                                    $t->assign([$val['name'] => $val['value']]);
                                }
                                else {
                                    $t->assign([$val['name'] => $this->useLang($val['value'])]);
                                }
                            }
                            echo $t->show();

                            $this->addError('The access to the page ' . $this->request->src . '/' . $this->request->controller . '/' . $this->request->action . ' is forbidden', __FILE__, __LINE__, ERROR_FATAL);

                            return false;
                        }
                    }
                    else {
                        $this->addError('The access to the page ' . $this->request->src . '/' . $this->request->controller . '/' . $this->request->action . ' is forbidden because the user must be logged', __FILE__, __LINE__, ERROR_FATAL);
                        $url = Url::get($this->_configFirewall['login']['name'], $this->_configFirewall['login']['vars']);

                        if ($url != "") {
                            $this->response->header('Location: ' . $url);

                            return false;
                        }
                        else {
                            $this->addError('The firewall failed to redirect the user to the url ' . $url, __FILE__, __LINE__, ERROR_FATAL);

                            return false;
                        }
                    }
                    break;

                case 'false' :
                    if ($this->_checkLogged() == false) {
                        return true;
                    }
                    else {
                        $this->addError('The access to the page ' . $this->request->src . '/' . $this->request->controller . '/' . $this->request->action . ' is forbidden because the user mustn\'t be logged', __FILE__, __LINE__, ERROR_FATAL);
                        $url = Url::get($this->_configFirewall['default']['name'], $this->_configFirewall['default']['vars']);

                        if ($url != "") {
                            $this->response->header('Location:' . $url);
                        }
                        else {
                            $this->addError('The firewall failed to redirect the user to the url ' . $url, __FILE__, __LINE__, ERROR_FATAL);

                            return false;
                        }

                        return false;
                    }
                    break;
            }
        }
        else {
            $t = new Template($this->_configFirewall['csrf']['template'], 'gcsfirewall', 0);
            foreach ($this->_configFirewall['csrf']['variable'] as $val) {
                if ($val['type'] == 'var') {
                    $t->assign([$val['name'] => $val['value']]);
                }
                else {
                    $t->assign([$val['name'] => $this->useLang($val['value'])]);
                }
            }

            echo $t->show();
            $this->addError('The access to the page ' . $this->request->src . '/' . $this->request->controller . '/' . $this->request->action . ' is forbidden : CSRF error', __FILE__, __LINE__, ERROR_FATAL);

            return false;
        }

        return true;
    }
249299
public function all()
    {
        $regex = '/'.
            '(_|^)'.
            '(get|post|put|delete|patch|head|options|mkcol|propfind|proppatch|lock|unlock|move|copy|link|unlink)_'. // allowed http methods
            '/i';

        $routes = parent::all();
        $customMethodRoutes = [];
        foreach ($routes as $routeName => $route) {
            if (!preg_match($regex, $routeName)) {
                $customMethodRoutes[$routeName] = $route;
                unset($routes[$routeName]);
            }
        }

        return $customMethodRoutes + $routes;
    }
742806
protected function routeContainsParent()
    {
        // get just the base url
        $route = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

        // lets split it into pieces
        $parts = explode('/', $route);

        // if a resource has a parent, it should be in the form /dogs/1/puppies
        // so the parent resource should be 2 spots before the child resource
        $resourcePosition = array_search($this->config->getResource(), $parts);

        return isset($parts[$resourcePosition - 2]);
    }
817770
protected function matchRoute()/*# : bool */
    {
        foreach ($this->getCollectors() as $coll) {
            if ($coll->matchRoute($this->result)) {
                return true;
            }
        }
        return false;
    }
310005
public function isValid()
    {
        $query = [
            'access_token' => $this['access_token'],
            'openid' => $this['openid'],
        ];

        $response = Http::request('GET', static::IS_VALID)
            ->withQuery($query)
            ->send();

        return 'ok' === $response['errmsg'];
    }
172480
public function checkNavigator()
    {
        // can we find th' darned controller?
        if (!$this->checkControllerExists()) {
            $this->setNotFound();
            return;
        }

        // merge the feckin params
        if (array_key_exists('params', $this->config) && is_array($this->config['params']) ) {
            $merged = array_merge($this->config['params'], $this->request->getQueryParams());
            $this->request = $this->request->withQueryParams($merged);
        }

        // create the controller
        $this->controller = new $this->config['controller_name']($this->request);
        $this->controller->setServerEnvironment($this->getEnv());

        // where's the bloody action?
        if (!$this->checkActionExists()) {
            $this->setNotFound();
        }
        return null;
    }
799728
private function match($request)
    {
        $route = $this->router->match(
            $request->getUri()->getPath(),
            $request->getMethod()
        );
        if (!$route) {
            // not matched. dispatch the next middleware.
            return $this->next ? $this->next->__invoke($request) : null;
        }
        return $this->dispatch($request, $route);
    }
1176554
public function matchesRequest()
    {
        return Collection::make($this->config->get('matchingData'))->diffAssoc($this->event)->isEmpty();
    }
1363019
public function match()
    {
        $elements = $this->getHostElements();

        return isset($elements[$this->elementNumber - 1]) ? $elements[$this->elementNumber - 1] : false;
    }
659119
protected function checkCrossDomain()
    {
        if (!empty($this->option['cross_domain'])) {

            $header = [
                'Access-Control-Allow-Origin' => '*',
                'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE',
                'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With',
            ];

            if (!empty($this->option['header'])) {
                $header = array_merge($header, $this->option['header']);
            }

            $this->option['header'] = $header;

            if (Request::getMethod() == 'OPTIONS') {
                return new ResponseDispatch($request, $this, Response::create()->code(204)->header($header));
            }
        }
    }
516673
public function verifyRoute(): void
    {
        $this->context->waitUntil($this->defaultTimeout, function () {
            return false !== strpos($this->context->getSession()->getCurrentUrl(), $this->route);
        });
    }
280679
protected function _actionCheck()
    {
        $actions = $this->getConfig('actions');
        if (is_bool($actions)) {
            return $actions;
        }

        return in_array($this->request->getParam('action'), (array)$actions, true);
    }
282509
private function matchExact(): bool
    {
        foreach ($this->routesExact as $route) {
            if ($this->uri === $route['u']) { // compare the current URI array to this route URI array
                $this->control = $route['c']; // set control or this exact match

                return true; // exact match found
            }
        }

        return false; // exact match not found
    }
1074805
public function matchRequest(Request $request)
    {
        $requestUrl = $request->getRouteURL();
        $requestMethod = $request->getMethod();

        if (empty($this->routes)) {
            $routeFile = basePath('app/Routes/web.php');
            if (file_exists($routeFile)) {
                /** @noinspection PhpIncludeInspection */
                require_once $routeFile;
            } else {
                throw new Exception("Route definition file $routeFile does not exist");
            }
        }

        $params = array();
        foreach ($this->routes as $handler) {
            $methods = $handler->getHttpMethod();
            $route = $handler->getRouteURI();

            $method_match = (stripos($methods, $requestMethod) !== false);

            // Method did not match, continue to next route.
            if (!$method_match) {
                continue;
            }

            if ($route === '*') {
                // * wildcard (matches all)
                $match = true;
            } elseif (isset($route[0]) && $route[0] === '@') {
                // @ regex delimiter
                $pattern = '`' . substr($route, 1) . '`u';
                $match = preg_match($pattern, $requestUrl, $params) === 1;
            } elseif (($position = strpos($route, '[')) === false) {
                // No params in url, do string comparison
                $match = strcmp($requestUrl, $route) === 0;
            } else {
                // Compare longest non-param string with url
                if (strncmp($requestUrl, $route, $position) !== 0) {
                    continue;
                }
                $regex = $this->compileRoute($route);
                $match = preg_match($regex, $requestUrl, $params) === 1;
            }

            if ($match) {
                if ($params) {
                    foreach ($params as $key => $value) {
                        if (is_numeric($key)) {
                            unset($params[$key]);
                        }
                    }
                }
                $handler->setParameters($params);
                $handler->lock();
                $request->setRoute($handler);

                return $handler;
            }
        }

        return false;
    }
588049
public function matchesRequest()
    {
        $noAttachments = $this->event->keys()->filter(function ($key) {
            return in_array($key, ['audio', 'voice', 'video', 'photo', 'location', 'contact', 'document']);
        })->isEmpty();

        return $noAttachments && (! is_null($this->event->get('from')) || ! is_null($this->payload->get('callback_query'))) && ! is_null($this->payload->get('update_id'));
    }