private static function checkRegexRoutes()
    {
        $pos = 0;

        self::getRegexRoutes();

        $method = $_SERVER['REQUEST_METHOD'];
        $searches = array_keys(self::$patterns);
        $replaces = array_values(self::$patterns);

        foreach (self::$routes as $route) {
            $segments = explode('/', str_replace($searches, '', $route));
            $route = str_replace($searches, $replaces, $route);
            $route = Url::addBackSlash($route);

            if (preg_match('#^' . $route . '$#', self::$uri, $matched)) {
                $methodRoute = self::$methods[$pos];

                if ($methodRoute == $method || $methodRoute == 'ANY') {
                    $matched = explode('/', trim($matched[0], '/'));
                    $matched = array_diff($matched, $segments);

                    if (! is_object(self::$callbacks[$pos])) {
                        self::$response = self::invokeObject(
                            self::$callbacks[$pos],
                            $matched
                        );
                    } else {
                        self::$response = call_user_func_array(
                            self::$callbacks[$pos],
                            $matched
                        );
                    }

                    if (! self::$halts) {
                        return self::$response;
                    }

                    self::$halts--;
                }
            }

            $pos++;
        }

        return self::$response;
    }
private static function checkRegexRoutes()
    {
        $pos = 0;

        self::getRegexRoutes();

        $method = $_SERVER['REQUEST_METHOD'];
        $searches = array_keys(self::$patterns);
        $replaces = array_values(self::$patterns);

        foreach (self::$routes as $route) {
            $segments = explode('/', str_replace($searches, '', $route));
            $route = str_replace($searches, $replaces, $route);
            $route = Url::addBackSlash($route);

            if (preg_match('#^' . $route . '$#', self::$uri, $matched)) {
                $methodRoute = self::$methods[$pos];

                if ($methodRoute == $method || $methodRoute == 'ANY') {
                    $matched = explode('/', trim($matched[0], '/'));
                    $matched = array_diff($matched, $segments);

                    if (! is_object(self::$callbacks[$pos])) {
                        self::$response = self::invokeObject(
                            self::$callbacks[$pos],
                            $matched
                        );
                    } else {
                        self::$response = call_user_func_array(
                            self::$callbacks[$pos],
                            $matched
                        );
                    }

                    if (! self::$halts) {
                        return self::$response;
                    }

                    self::$halts--;
                }
            }

            $pos++;
        }

        return self::$response;
    }
private static function checkRegexRoutes ( ) { $ pos = 0 ; self :: getRegexRoutes ( ) ; $ method = $ _SERVER [ 'REQUEST_METHOD' ] ; $ searches = array_keys ( self :: $ patterns ) ; $ replaces = array_values ( self :: $ patterns ) ; foreach ( self :: $ routes as $ route ) { $ segments = explode ( '/' , str_replace ( $ searches , '' , $ route ) ) ; $ route = str_replace ( $ searches , $ replaces , $ route ) ; $ route = Url :: addBackSlash ( $ route ) ; if ( preg_match ( '#^' . $ route . '$#' , self :: $ uri , $ matched ) ) { $ methodRoute = self :: $ methods [ $ pos ] ; if ( $ methodRoute == $ method || $ methodRoute == 'ANY' ) { $ matched = explode ( '/' , trim ( $ matched [ 0 ] , '/' ) ) ; $ matched = array_diff ( $ matched , $ segments ) ; if ( ! is_object ( self :: $ callbacks [ $ pos ] ) ) { self :: $ response = self :: invokeObject ( self :: $ callbacks [ $ pos ] , $ matched ) ; } else { self :: $ response = call_user_func_array ( self :: $ callbacks [ $ pos ] , $ matched ) ; } if ( ! self :: $ halts ) { return self :: $ response ; } self :: $ halts -- ; } } $ pos ++ ; } return self :: $ response ; }
Check if route is defined with regex.

@uses \string Url::addBackSlash → add backslash if it doesn't exist

@return callable|false
Check if route is defined with regex .