- $httpMethod = $this->server['REQUEST_METHOD'] ?? self::GET;
-
- // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
- // @todo Check allowed methods per requested path
- if ($httpMethod === static::OPTIONS) {
- header('Allow: ' . implode(',', Router::ALLOWED_METHODS));
- throw new NoContentException();
- }
-
- $this->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET;
-
- $this->routeCollector = isset($routeCollector) ?
- $routeCollector :
- new RouteCollector(new Std(), new GroupCountBased());