public function matchRoot(&$request)
    {
        // empty means match always.
        if (empty($this->_patterns)) {
            return true;
        }
        $path   = $request->getPathToMatch();
        $method = $request->getMethod();
        foreach ($this->_patterns as $pattern) {
            if ($matched = Matcher::verify($pattern, $path, $method)) {
                if (isset($matched['matched'])) {
                    $request = $request->withPathToMatch($matched['matched'], $matched['trailing']);
                }
                return true;
            }
        }
        return false;
    }
public function matchRoot(&$request)
    {
        // empty means match always.
        if (empty($this->_patterns)) {
            return true;
        }
        $path   = $request->getPathToMatch();
        $method = $request->getMethod();
        foreach ($this->_patterns as $pattern) {
            if ($matched = Matcher::verify($pattern, $path, $method)) {
                if (isset($matched['matched'])) {
                    $request = $request->withPathToMatch($matched['matched'], $matched['trailing']);
                }
                return true;
            }
        }
        return false;
    }
public function matchRoot ( & $ request ) { // empty means match always. if ( empty ( $ this -> _patterns ) ) { return true ; } $ path = $ request -> getPathToMatch ( ) ; $ method = $ request -> getMethod ( ) ; foreach ( $ this -> _patterns as $ pattern ) { if ( $ matched = Matcher :: verify ( $ pattern , $ path , $ method ) ) { if ( isset ( $ matched [ 'matched' ] ) ) { $ request = $ request -> withPathToMatch ( $ matched [ 'matched' ] , $ matched [ 'trailing' ] ) ; } return true ; } } return false ; }
check if the requested path matches with the root.

returns $request if matches, or return false if not matched
(i.e. execute the next middleware).

@param Request $request
@return bool
check if the requested path matches with the root .