httpMethod = $httpMethod; $this->handler = $handler; $this->regex = $regex; $this->variables = $variables; } /** * Tests whether this route matches the given string. */ public function matches(string $str): bool { $regex = '~^' . $this->regex . '$~'; return (bool) preg_match($regex, $str); } }