22 if (isset($this->staticRouteMap[$httpMethod][$uri])) {
23 $handler = $this->staticRouteMap[$httpMethod][$uri];
28 if (isset($varRouteData[$httpMethod])) {
30 if (
$result[0] === self::FOUND) {
36 if ($httpMethod ===
'HEAD') {
37 if (isset($this->staticRouteMap[
'GET'][$uri])) {
38 $handler = $this->staticRouteMap[
'GET'][$uri];
41 if (isset($varRouteData[
'GET'])) {
43 if (
$result[0] === self::FOUND) {
50 if (isset($this->staticRouteMap[
'*'][$uri])) {
51 $handler = $this->staticRouteMap[
'*'][$uri];
54 if (isset($varRouteData[
'*'])) {
56 if (
$result[0] === self::FOUND) {
64 foreach ($this->staticRouteMap as $method => $uriMap) {
65 if ($method !== $httpMethod && isset($uriMap[$uri])) {
66 $allowedMethods[] = $method;
70 foreach ($varRouteData as $method => $routeData) {
71 if ($method === $httpMethod) {
76 if (
$result[0] === self::FOUND) {
77 $allowedMethods[] = $method;
82 if ($allowedMethods) {
83 return [self::METHOD_NOT_ALLOWED, $allowedMethods];
86 return [self::NOT_FOUND];
dispatch($httpMethod, $uri)
Dispatches against the provided HTTP method verb and URI.
dispatchVariableRoute($routeData, $uri)