private function isMatching(RequestInterface $request, &$route): int
    {
        $match = -1;

        $pattern = str_replace('/', '\/', trim($route['pattern'], '/'));
        $pattern = str_replace(array_keys(self::$expressions), array_values(self::$expressions), $pattern);

        if (preg_match('/^' . $pattern . '$/', ltrim($request->getUri()->getPath(), '/'), $matches)) {
            $match = $this->rate($route['target'], $matches);
        }

        return $match;
    }
private function isMatching(RequestInterface $request, &$route): int
    {
        $match = -1;

        $pattern = str_replace('/', '\/', trim($route['pattern'], '/'));
        $pattern = str_replace(array_keys(self::$expressions), array_values(self::$expressions), $pattern);

        if (preg_match('/^' . $pattern . '$/', ltrim($request->getUri()->getPath(), '/'), $matches)) {
            $match = $this->rate($route['target'], $matches);
        }

        return $match;
    }
private function isMatching ( RequestInterface $ request , & $ route ) : int { $ match = - 1 ; $ pattern = str_replace ( '/' , '\/' , trim ( $ route [ 'pattern' ] , '/' ) ) ; $ pattern = str_replace ( array_keys ( self :: $ expressions ) , array_values ( self :: $ expressions ) , $ pattern ) ; if ( preg_match ( '/^' . $ pattern . '$/' , ltrim ( $ request -> getUri ( ) -> getPath ( ) , '/' ) , $ matches ) ) { $ match = $ this -> rate ( $ route [ 'target' ] , $ matches ) ; } return $ match ; }
Match request against given route

@param \Psr\Http\Message\RequestInterface $request
@param array &$route
@return int
Match request against given route