in src/router/BaseRouter.php [17:45]
abstract protected function getRoutes(
): KeyedContainer<HttpMethod, KeyedContainer<string, TResponder>>;
final public function routeMethodAndPath(
HttpMethod $method,
string $path,
): (TResponder, ImmMap<string, string>) {
$resolver = $this->getResolver();
try {
list($responder, $data) = $resolver->resolve($method, $path);
$data = Dict\map($data, $value ==> \urldecode($value));
return tuple($responder, new ImmMap($data));
} catch (NotFoundException $e) {
$allowed = $this->getAllowedMethods($path);
if (C\is_empty($allowed)) {
throw $e;
}
if (
$method === HttpMethod::HEAD && $allowed === keyset[HttpMethod::GET]
) {
list($responder, $data) = $resolver->resolve(HttpMethod::GET, $path);
$data = Dict\map($data, $value ==> \urldecode($value));
return tuple($responder, new ImmMap($data));
}
throw new MethodNotAllowedException($allowed);
}
}