public function matchRequest($requestedRoute, $httpMethod)
    {
        // Iterate through each route that has been registered
        foreach ($this->routes as $route => $callback) {
            
            // Convert the route to a regex pattern
            $routeRx = preg_replace(
                        '%/:([^ /?]+)(\?)?%',
                        '/\2(?P<\1>[^ /?]+)\2',
                    $route);
            
            // If the route also defined a HTTP method to match against, 
            // append the requested route with the request's method
            $routeMethod = strstr($route, ':', true);
            if ($routeMethod && substr($routeMethod, -1) != '/') {
                $requestPrepend = strtolower($httpMethod).':';
            } else {
                $requestPrepend = '';
            }
            
            // Check for a regex match with the requested route. Store the 
            // matches in a variable so the Request instance can be informed.
            if (preg_match('%^' . $routeRx . '$%',
                            $requestPrepend.$requestedRoute,
                            $uriParams)
                ) {
                // A route match was found
                
                // Before returning true, store the params 
                // that were matched, and store the matched route.
                foreach ($uriParams as $key => $value) {
                    if (is_numeric($key)) unset($uriParams[$key]);
                }
                $this->params = (object) $uriParams;
                $this->matched = $route;
                
                return true;
            }
        }
        
        // No matches caught
        return false;
    }
public function matchRequest($requestedRoute, $httpMethod)
    {
        // Iterate through each route that has been registered
        foreach ($this->routes as $route => $callback) {
            
            // Convert the route to a regex pattern
            $routeRx = preg_replace(
                        '%/:([^ /?]+)(\?)?%',
                        '/\2(?P<\1>[^ /?]+)\2',
                    $route);
            
            // If the route also defined a HTTP method to match against, 
            // append the requested route with the request's method
            $routeMethod = strstr($route, ':', true);
            if ($routeMethod && substr($routeMethod, -1) != '/') {
                $requestPrepend = strtolower($httpMethod).':';
            } else {
                $requestPrepend = '';
            }
            
            // Check for a regex match with the requested route. Store the 
            // matches in a variable so the Request instance can be informed.
            if (preg_match('%^' . $routeRx . '$%',
                            $requestPrepend.$requestedRoute,
                            $uriParams)
                ) {
                // A route match was found
                
                // Before returning true, store the params 
                // that were matched, and store the matched route.
                foreach ($uriParams as $key => $value) {
                    if (is_numeric($key)) unset($uriParams[$key]);
                }
                $this->params = (object) $uriParams;
                $this->matched = $route;
                
                return true;
            }
        }
        
        // No matches caught
        return false;
    }
public function matchRequest ( $ requestedRoute , $ httpMethod ) { // Iterate through each route that has been registered foreach ( $ this -> routes as $ route => $ callback ) { // Convert the route to a regex pattern $ routeRx = preg_replace ( '%/:([^ /?]+)(\?)?%' , '/\2(?P<\1>[^ /?]+)\2' , $ route ) ; // If the route also defined a HTTP method to match against,  // append the requested route with the request's method $ routeMethod = strstr ( $ route , ':' , true ) ; if ( $ routeMethod && substr ( $ routeMethod , - 1 ) != '/' ) { $ requestPrepend = strtolower ( $ httpMethod ) . ':' ; } else { $ requestPrepend = '' ; } // Check for a regex match with the requested route. Store the  // matches in a variable so the Request instance can be informed. if ( preg_match ( '%^' . $ routeRx . '$%' , $ requestPrepend . $ requestedRoute , $ uriParams ) ) { // A route match was found // Before returning true, store the params  // that were matched, and store the matched route. foreach ( $ uriParams as $ key => $ value ) { if ( is_numeric ( $ key ) ) unset ( $ uriParams [ $ key ] ) ; } $ this -> params = ( object ) $ uriParams ; $ this -> matched = $ route ; return true ; } } // No matches caught return false ; }
Compares the requested route param with the registered routes and checks
whether there is a match - true on a match, false if not.

@param string $requestedRoute
@param string $httpMethod
@return boolean
Compares the requested route param with the registered routes and checks whether there is a match - true on a match false if not .