public function match($request, &$variables = null, &$hostVariables = null)
    {
        $hostVariables = [];

        if (($host = $this->host()) && !$host->match($request, $hostVariables)) {
            return false;
        }

        $path = isset($request['path']) ? $request['path'] : '';
        $method = isset($request['method']) ? $request['method'] : '*';

        if (!isset($this->_methods['*']) && $method !== '*' && !isset($this->_methods[$method])) {
            if ($method !== 'HEAD' && !isset($this->_methods['GET'])) {
                return false;
            }
        }

        $path = '/' . trim($path, '/');

        if (!preg_match('~^' . $this->regex() . '$~', $path, $matches)) {
            return false;
        }
        $variables = $this->_buildVariables($matches);
        $this->params = $hostVariables + $variables;
        return true;
    }
public function match($request, &$variables = null, &$hostVariables = null)
    {
        $hostVariables = [];

        if (($host = $this->host()) && !$host->match($request, $hostVariables)) {
            return false;
        }

        $path = isset($request['path']) ? $request['path'] : '';
        $method = isset($request['method']) ? $request['method'] : '*';

        if (!isset($this->_methods['*']) && $method !== '*' && !isset($this->_methods[$method])) {
            if ($method !== 'HEAD' && !isset($this->_methods['GET'])) {
                return false;
            }
        }

        $path = '/' . trim($path, '/');

        if (!preg_match('~^' . $this->regex() . '$~', $path, $matches)) {
            return false;
        }
        $variables = $this->_buildVariables($matches);
        $this->params = $hostVariables + $variables;
        return true;
    }
public function match ( $ request , & $ variables = null , & $ hostVariables = null ) { $ hostVariables = [ ] ; if ( ( $ host = $ this -> host ( ) ) && ! $ host -> match ( $ request , $ hostVariables ) ) { return false ; } $ path = isset ( $ request [ 'path' ] ) ? $ request [ 'path' ] : '' ; $ method = isset ( $ request [ 'method' ] ) ? $ request [ 'method' ] : '*' ; if ( ! isset ( $ this -> _methods [ '*' ] ) && $ method !== '*' && ! isset ( $ this -> _methods [ $ method ] ) ) { if ( $ method !== 'HEAD' && ! isset ( $ this -> _methods [ 'GET' ] ) ) { return false ; } } $ path = '/' . trim ( $ path , '/' ) ; if ( ! preg_match ( '~^' . $ this -> regex ( ) . '$~' , $ path , $ matches ) ) { return false ; } $ variables = $ this -> _buildVariables ( $ matches ) ; $ this -> params = $ hostVariables + $ variables ; return true ; }
Checks if the route instance matches a request.

@param  array   $request a request.
@return boolean
Checks if the route instance matches a request .