Core/Routing/Route.php
public function matches($uri, $method)
    {
        // Check if request method matches.
        if (in_array($method, $this->methods)) {
            $paramValues = [];

            // Replace parameters with proper regex patterns.
            $urlRegex = preg_replace_callback(self::MATCHES_REGEX, [$this, 'regexUrl'], $this->url);

            // Check if URI matches and if it matches put results in values array.
            $pattern = '@^' . $urlRegex . '/?$@' . ($this->matchUnicode?'u':'');
            if (preg_match($pattern, $uri, $paramValues) === 1) {// There is a match.
                // Extract parameter names.
                $paramNames = [];
                preg_match_all(self::MATCHES_REGEX, $this->url, $paramNames, PREG_PATTERN_ORDER);

                // Put parameters to array to be passed to controller/function later.
                foreach ($paramNames[0] as $index => $value) {
                    $this->params[substr($value, 1)] = urldecode($paramValues[$index + 1]);
                }

                // Append passed params to executable
                $this->executable->addParams($this->params);

                // Everything is done return true.
                return true;
            }
        }
        // No match found return false.
        return false;
    }
public function matches($uri, $method)
    {
        // Check if request method matches.
        if (in_array($method, $this->methods)) {
            $paramValues = [];

            // Replace parameters with proper regex patterns.
            $urlRegex = preg_replace_callback(self::MATCHES_REGEX, [$this, 'regexUrl'], $this->url);

            // Check if URI matches and if it matches put results in values array.
            $pattern = '@^' . $urlRegex . '/?$@' . ($this->matchUnicode?'u':'');
            if (preg_match($pattern, $uri, $paramValues) === 1) {// There is a match.
                // Extract parameter names.
                $paramNames = [];
                preg_match_all(self::MATCHES_REGEX, $this->url, $paramNames, PREG_PATTERN_ORDER);

                // Put parameters to array to be passed to controller/function later.
                foreach ($paramNames[0] as $index => $value) {
                    $this->params[substr($value, 1)] = urldecode($paramValues[$index + 1]);
                }

                // Append passed params to executable
                $this->executable->addParams($this->params);

                // Everything is done return true.
                return true;
            }
        }
        // No match found return false.
        return false;
    }
public function matches ( $ uri , $ method ) { // Check if request method matches. if ( in_array ( $ method , $ this -> methods ) ) { $ paramValues = [ ] ; // Replace parameters with proper regex patterns. $ urlRegex = preg_replace_callback ( self :: MATCHES_REGEX , [ $ this , 'regexUrl' ] , $ this -> url ) ; // Check if URI matches and if it matches put results in values array. $ pattern = '@^' . $ urlRegex . '/?$@' . ( $ this -> matchUnicode ? 'u' : '' ) ; if ( preg_match ( $ pattern , $ uri , $ paramValues ) === 1 ) { // There is a match. // Extract parameter names. $ paramNames = [ ] ; preg_match_all ( self :: MATCHES_REGEX , $ this -> url , $ paramNames , PREG_PATTERN_ORDER ) ; // Put parameters to array to be passed to controller/function later. foreach ( $ paramNames [ 0 ] as $ index => $ value ) { $ this -> params [ substr ( $ value , 1 ) ] = urldecode ( $ paramValues [ $ index + 1 ] ) ; } // Append passed params to executable $ this -> executable -> addParams ( $ this -> params ) ; // Everything is done return true. return true ; } } // No match found return false. return false ; }
Check if requested URI and method matches this route.

@param string $uri
@param string $method
@return bool
Check if requested URI and method matches this route .