public function match($segment, array $map)
    {
        foreach ($map as $index => $uriTemplate) {
            $matches = array();
            if (preg_match($this->createRegEx($uriTemplate), $segment, $matches) === 1) {
                $matchedURI = array_shift($matches);

                $routeMatch = new RouteMatch();
                $routeMatch->setMatchedUri($matchedURI)
                            ->setMatchedUriTemplate($uriTemplate)
                            ->setVariables($matches);

                return $routeMatch;
            }
        }

        // By default, we have no matches
        return false;
    }
public function match($segment, array $map)
    {
        foreach ($map as $index => $uriTemplate) {
            $matches = array();
            if (preg_match($this->createRegEx($uriTemplate), $segment, $matches) === 1) {
                $matchedURI = array_shift($matches);

                $routeMatch = new RouteMatch();
                $routeMatch->setMatchedUri($matchedURI)
                            ->setMatchedUriTemplate($uriTemplate)
                            ->setVariables($matches);

                return $routeMatch;
            }
        }

        // By default, we have no matches
        return false;
    }
public function match ( $ segment , array $ map ) { foreach ( $ map as $ index => $ uriTemplate ) { $ matches = array ( ) ; if ( preg_match ( $ this -> createRegEx ( $ uriTemplate ) , $ segment , $ matches ) === 1 ) { $ matchedURI = array_shift ( $ matches ) ; $ routeMatch = new RouteMatch ( ) ; $ routeMatch -> setMatchedUri ( $ matchedURI ) -> setMatchedUriTemplate ( $ uriTemplate ) -> setVariables ( $ matches ) ; return $ routeMatch ; } } // By default, we have no matches return false ; }
Matches a URI string against a route map

@param string $segment The actual segment to match against
@param array $map Target route map to compare against
@return boolean|\Krystal\Application\Route\RouteMatch
Matches a URI string against a route map