Dispatches against the provided HTTP method verb and URI.
Returns array with one of the following formats:
[self::NOT_FOUND]
[self::METHOD_NOT_ALLOWED, ['GET', 'OTHER_ALLOWED_METHODS']]
[self::FOUND, $handler, ['varName' => 'value', ...]]
- Parameters
-
string | $httpMethod | |
string | $uri | |
- Returns
- array
Implements FastRoute\Dispatcher.
Definition at line 20 of file RegexBasedAbstract.php.
21 {
22 if (isset($this->staticRouteMap[$httpMethod][$uri])) {
23 $handler = $this->staticRouteMap[$httpMethod][$uri];
25 }
26
28 if (isset($varRouteData[$httpMethod])) {
30 if (
$result[0] === self::FOUND) {
32 }
33 }
34
35
36 if ($httpMethod === 'HEAD') {
37 if (isset($this->staticRouteMap['GET'][$uri])) {
38 $handler = $this->staticRouteMap[
'GET'][$uri];
40 }
41 if (isset($varRouteData['GET'])) {
43 if (
$result[0] === self::FOUND) {
45 }
46 }
47 }
48
49
50 if (isset($this->staticRouteMap['*'][$uri])) {
51 $handler = $this->staticRouteMap[
'*'][$uri];
53 }
54 if (isset($varRouteData['*'])) {
56 if (
$result[0] === self::FOUND) {
58 }
59 }
60
61
62 $allowedMethods = [];
63
64 foreach ($this->staticRouteMap as $method => $uriMap) {
65 if ($method !== $httpMethod && isset($uriMap[$uri])) {
66 $allowedMethods[] = $method;
67 }
68 }
69
70 foreach ($varRouteData as $method => $routeData) {
71 if ($method === $httpMethod) {
72 continue;
73 }
74
76 if (
$result[0] === self::FOUND) {
77 $allowedMethods[] = $method;
78 }
79 }
80
81
82 if ($allowedMethods) {
84 }
85
87 }
dispatchVariableRoute($routeData, $uri)
References $handler, $result, FastRoute\Dispatcher\RegexBasedAbstract\$variableRouteData, FastRoute\Dispatcher\RegexBasedAbstract\dispatchVariableRoute(), FastRoute\Dispatcher\FOUND, FastRoute\Dispatcher\METHOD_NOT_ALLOWED, and FastRoute\Dispatcher\NOT_FOUND.