Component/Routing/Matcher.php
public function getCandidates()
    {
        $candidates = array();

        foreach ($this->collection->all() as $name => $route) {
            $specs = array();

            preg_match_all('/\{\w+\}/', $route->getPath(), $matches);

            if (isset($matches[0])) {
                $specs = $matches[0];
            }

            foreach ($specs as $spec) {
                $param          = substr($spec, 1, -1);
                $regexSpec      = '\\'.$spec.'\\';
                $requirements   = $route->getRequirements();

                if (isset($requirements[$param])) {
                    $route->setRegex(

                        str_replace(
                            $spec,
                            $this->getRegexOperand($requirements[$param]),
                            $route->getRegex()
                        )
                    );
                }
            }

            // Build regeular expression to match routes
            $route->setRegex('^'.'/'.ltrim(trim($route->getRegex()), '/').'/?$');
            $route->setRegex('/'.str_replace('/', '\/', $route->getRegex()).'/');

            if (preg_match($route->getRegex(), $this->request->getPathInfo())) {
                // We have a match
                $candidates[] = $route;
            }
        }

        return $candidates;
    }
public function getCandidates()
    {
        $candidates = array();

        foreach ($this->collection->all() as $name => $route) {
            $specs = array();

            preg_match_all('/\{\w+\}/', $route->getPath(), $matches);

            if (isset($matches[0])) {
                $specs = $matches[0];
            }

            foreach ($specs as $spec) {
                $param          = substr($spec, 1, -1);
                $regexSpec      = '\\'.$spec.'\\';
                $requirements   = $route->getRequirements();

                if (isset($requirements[$param])) {
                    $route->setRegex(

                        str_replace(
                            $spec,
                            $this->getRegexOperand($requirements[$param]),
                            $route->getRegex()
                        )
                    );
                }
            }

            // Build regeular expression to match routes
            $route->setRegex('^'.'/'.ltrim(trim($route->getRegex()), '/').'/?$');
            $route->setRegex('/'.str_replace('/', '\/', $route->getRegex()).'/');

            if (preg_match($route->getRegex(), $this->request->getPathInfo())) {
                // We have a match
                $candidates[] = $route;
            }
        }

        return $candidates;
    }
public function getCandidates ( ) { $ candidates = array ( ) ; foreach ( $ this -> collection -> all ( ) as $ name => $ route ) { $ specs = array ( ) ; preg_match_all ( '/\{\w+\}/' , $ route -> getPath ( ) , $ matches ) ; if ( isset ( $ matches [ 0 ] ) ) { $ specs = $ matches [ 0 ] ; } foreach ( $ specs as $ spec ) { $ param = substr ( $ spec , 1 , - 1 ) ; $ regexSpec = '\\' . $ spec . '\\' ; $ requirements = $ route -> getRequirements ( ) ; if ( isset ( $ requirements [ $ param ] ) ) { $ route -> setRegex ( str_replace ( $ spec , $ this -> getRegexOperand ( $ requirements [ $ param ] ) , $ route -> getRegex ( ) ) ) ; } } // Build regeular expression to match routes $ route -> setRegex ( '^' . '/' . ltrim ( trim ( $ route -> getRegex ( ) ) , '/' ) . '/?$' ) ; $ route -> setRegex ( '/' . str_replace ( '/' , '\/' , $ route -> getRegex ( ) ) . '/' ) ; if ( preg_match ( $ route -> getRegex ( ) , $ this -> request -> getPathInfo ( ) ) ) { // We have a match $ candidates [ ] = $ route ; } } return $ candidates ; }
Gets list of candidate Route objects for request

@return array    List of Route objects
Gets list of candidate Route objects for request