|
| dispatch ($httpMethod, $uri) |
| Dispatches against the provided HTTP method verb and URI. More...
|
|
Definition at line 7 of file RegexBasedAbstract.php.
◆ dispatch()
FastRoute\Dispatcher\RegexBasedAbstract::dispatch |
( |
|
$httpMethod, |
|
|
|
$uri |
|
) |
| |
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.
References $handler, $result, FastRoute\Dispatcher\RegexBasedAbstract\$variableRouteData, and FastRoute\Dispatcher\RegexBasedAbstract\dispatchVariableRoute().
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];
dispatchVariableRoute($routeData, $uri)
◆ dispatchVariableRoute()
FastRoute\Dispatcher\RegexBasedAbstract::dispatchVariableRoute |
( |
|
$routeData, |
|
|
|
$uri |
|
) |
| |
|
abstractprotected |
◆ $staticRouteMap
FastRoute\Dispatcher\RegexBasedAbstract::$staticRouteMap = [] |
|
protected |
◆ $variableRouteData
FastRoute\Dispatcher\RegexBasedAbstract::$variableRouteData = [] |
|
protected |
The documentation for this class was generated from the following file: