public function process(Request $request)
    {
        $results = [];

        // Test hostname rule.
        if (isset($this->options['hostname'])) {
            $regex           = $this->compileRegex($this->options['hostname']);
            $tokens          = $this->compileTokens($this->options['hostname']);
            $hostnameResults = $this->compileResults($regex, $tokens, $request->getHttpHost());

            if ($hostnameResults === false) {
                return false;
            } else {
                $results = array_merge($results, $hostnameResults);
            }
        }

        // Test the main url rule.
        $regex      = $this->compileRegex($this->rule);
        $tokens     = $this->compileTokens($this->rule);
        $urlResults = $this->compileResults($regex, $tokens, $request->getRequestUri());

        if ($urlResults === false) {
            return false;
        } else {
            $results = array_merge($results, $urlResults);
        }

        if (isset($this->options['targets'])) {
            $results = array_merge($results, $this->options['targets']);
        }

        $this->payload = $results;
        return true;
    }
public function process(Request $request)
    {
        $results = [];

        // Test hostname rule.
        if (isset($this->options['hostname'])) {
            $regex           = $this->compileRegex($this->options['hostname']);
            $tokens          = $this->compileTokens($this->options['hostname']);
            $hostnameResults = $this->compileResults($regex, $tokens, $request->getHttpHost());

            if ($hostnameResults === false) {
                return false;
            } else {
                $results = array_merge($results, $hostnameResults);
            }
        }

        // Test the main url rule.
        $regex      = $this->compileRegex($this->rule);
        $tokens     = $this->compileTokens($this->rule);
        $urlResults = $this->compileResults($regex, $tokens, $request->getRequestUri());

        if ($urlResults === false) {
            return false;
        } else {
            $results = array_merge($results, $urlResults);
        }

        if (isset($this->options['targets'])) {
            $results = array_merge($results, $this->options['targets']);
        }

        $this->payload = $results;
        return true;
    }
public function process ( Request $ request ) { $ results = [ ] ; // Test hostname rule. if ( isset ( $ this -> options [ 'hostname' ] ) ) { $ regex = $ this -> compileRegex ( $ this -> options [ 'hostname' ] ) ; $ tokens = $ this -> compileTokens ( $ this -> options [ 'hostname' ] ) ; $ hostnameResults = $ this -> compileResults ( $ regex , $ tokens , $ request -> getHttpHost ( ) ) ; if ( $ hostnameResults === false ) { return false ; } else { $ results = array_merge ( $ results , $ hostnameResults ) ; } } // Test the main url rule. $ regex = $ this -> compileRegex ( $ this -> rule ) ; $ tokens = $ this -> compileTokens ( $ this -> rule ) ; $ urlResults = $ this -> compileResults ( $ regex , $ tokens , $ request -> getRequestUri ( ) ) ; if ( $ urlResults === false ) { return false ; } else { $ results = array_merge ( $ results , $ urlResults ) ; } if ( isset ( $ this -> options [ 'targets' ] ) ) { $ results = array_merge ( $ results , $ this -> options [ 'targets' ] ) ; } $ this -> payload = $ results ; return true ; }
Process this route.

Takes a simplified series of patterns such as {controller} and
replaces them with more complex regular expressions which are then used
to match against a given *haystack* string.

@param Proem\Http\Request $request
@return false|array False on fail to match, otherwise array of results.
Process this route .