src/UriHandler.php
public function match(UriInterface $uri, array $defaults): ?array
    {
        if (!$this->isCompiled()) {
            $this->compile();
        }

        $matches = [];
        if (!preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
            return null;
        }

        $matches = array_intersect_key($matches, $this->options);

        return array_merge($this->options, $defaults, $matches);
    }
public function match(UriInterface $uri, array $defaults): ?array
    {
        if (!$this->isCompiled()) {
            $this->compile();
        }

        $matches = [];
        if (!preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
            return null;
        }

        $matches = array_intersect_key($matches, $this->options);

        return array_merge($this->options, $defaults, $matches);
    }
public function match ( UriInterface $ uri , array $ defaults ) : ? array { if ( ! $ this -> isCompiled ( ) ) { $ this -> compile ( ) ; } $ matches = [ ] ; if ( ! preg_match ( $ this -> compiled , $ this -> fetchTarget ( $ uri ) , $ matches ) ) { return null ; } $ matches = array_intersect_key ( $ matches , $ this -> options ) ; return array_merge ( $ this -> options , $ defaults , $ matches ) ; }
Match given url against compiled template and return matches array or null if pattern does
not match.

@param UriInterface $uri
@param array        $defaults
@return array|null
Match given url against compiled template and return matches array or null if pattern does not match .