public function match($uri)
{
$matches = [];
if ($this->_httpMethod !== null && $this->_httpMethod !== $_SERVER['REQUEST_METHOD']) {
return false;
}
if (Text::contains($this->_compiledPattern, '^')) {
$r = preg_match($this->_compiledPattern, $uri, $matches);
if ($r === false) {
throw new RouteException('`:compiled` pcre pattern is invalid for `:pattern`', ['compiled' => $this->_compiledPattern, 'pattern' => $this->_pattern]);
} elseif ($r === 1) {
return $matches;
} else {
return false;
}
} else {
if ($this->_compiledPattern === $uri) {
return $matches;
} else {
return false;
}
}
}