} */ public function dispatch($httpMethod, $uri): array { $routingResults = $this->routingResults($httpMethod, $uri); if ($routingResults[0] === self::FOUND) { return $routingResults; } // For HEAD requests, attempt fallback to GET if ($httpMethod === 'HEAD') { $routingResults = $this->routingResults('GET', $uri); if ($routingResults[0] === self::FOUND) { return $routingResults; } } // If nothing else matches, try fallback routes $routingResults = $this->routingResults('*', $uri); if ($routingResults[0] === self::FOUND) { return $routingResults; } if (!empty($this->getAllowedMethods($uri))) { return [self::METHOD_NOT_ALLOWED, null, []]; } return [self::NOT_FOUND, null, []]; } /** * @param string $httpMethod * @param string $uri * * @return array{int, string|null, array} */ private function routingResults(string $httpMethod, string $uri): array { if (isset($this->staticRouteMap[$httpMethod][$uri])) { /** @var string $routeIdentifier */ $routeIdentifier = $this->staticRouteMap[$httpMethod][$uri]; return [self::FOUND, $routeIdentifier, []]; } if (isset($this->variableRouteData[$httpMethod])) { /** @var array{0: int, 1?: string, 2?: array} $result */ $result = $this->dispatchVariableRoute($this->variableRouteData[$httpMethod], $uri); if ($result[0] === self::FOUND) { /** @var array{int, string, array} $result */ return [self::FOUND, $result[1], $result[2]]; } } return [self::NOT_FOUND, null, []]; } /** * @param string $uri * * @return string[] */ public function getAllowedMethods(string $uri): array { if (isset($this->allowedMethods[$uri])) { return $this->allowedMethods[$uri]; } $this->allowedMethods[$uri] = []; foreach ($this->staticRouteMap as $method => $uriMap) { if (isset($uriMap[$uri])) { $this->allowedMethods[$uri][] = $method; } } foreach ($this->variableRouteData as $method => $routeData) { $result = $this->dispatchVariableRoute($routeData, $uri); if ($result[0] === self::FOUND) { $this->allowedMethods[$uri][] = $method; } } return $this->allowedMethods[$uri]; } } __halt_compiler();----SIGNATURE:----Oi8qc699WjMuJ5dWLF/mAM2nwgSQaKIq3TdxZ+t2mBGRUI43gh+yC1J5jPEQqP+rxBYQojZPk7a4yAS2euumn+F78F3yVtaSbhLSydO6FgSUZipN9XlukegnkmHj1moteLXQmaxucXuNMeJld0O96nPp4wX1CDJwPpnXWF6AKe+wBX9PfjSnSzPHCmtOCPswQ0E8GXX/bYzVC1YJ1WhyFSkdLHjB5yite8lnru8ydEPzTXpwJjz4Dj0CMt26A7s5lUe6odV624rzdSf61V0lCj2tPkB9CceSAjGZHDvQpMAk6R/3W/wKMJJonPgAoqzj+T9EMPPV0BJxVMtfsQL7tACHynSryLIeBHAm6VGN9+PGPewM9kYknjaombu2tFINuqONjTYgIICUz7mL9qX+6YAvsmCM4E55uq6TQKeIqjkygupQsTiSBdNx8xnKp6JrrQ4ljzJsRAM9E7gDkiU46ZXKpFvo3aZz77G2gvZvvp55pTCM0UV626eD6s1oASkPqoXEaM293ooBUTlmoELBLBlg2yAPX0S2JgE854ui/UZ6FXSbtWgdq3hUPFuYTF0z8hH8X7ID/OaO6E3DKur1xRLZpf7yt8yFAIA6GlvOKzdI+eZXOZF/LHVJX34ILhMLvOmZvw6xMkctJjgEpu4woLOULJAUz8ECByFU41xE8wM=----ATTACHMENT:----NTEyNTg5MTMxODc4ODQ2NyA2MzMwODYyMDg1OTQ5MDg2IDE4NTgwNTA3ODU4Mjk2MjE=