| @@ 140-157 (lines=18) @@ | ||
| 137 | * @return mixed the result of the given route's callable. |
|
| 138 | * @throws ServerResponseException |
|
| 139 | */ |
|
| 140 | public function resolve($method = null, $route = null) |
|
| 141 | { |
|
| 142 | $serverRequest = new ServerRequest(); |
|
| 143 | ||
| 144 | if ($method === null) { |
|
| 145 | $method = $serverRequest->getMethod(); |
|
| 146 | } |
|
| 147 | ||
| 148 | if ($route === null) { |
|
| 149 | $route = $serverRequest->getUri()->getPath(); |
|
| 150 | } |
|
| 151 | ||
| 152 | if ($this->basePath !== '' && strpos($route, $this->basePath, 0) === 0) { |
|
| 153 | $route = substr($route, strlen($this->basePath)); |
|
| 154 | } |
|
| 155 | ||
| 156 | return $this->callCallable($this->getCallable($method, $route)); |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * Returns the result of the callable. |
|
| @@ 249-266 (lines=18) @@ | ||
| 246 | * @return mixed the result of the given route's callable. |
|
| 247 | * @throws ServerResponseException |
|
| 248 | */ |
|
| 249 | public function resolve($method = null, $route = null) |
|
| 250 | { |
|
| 251 | $serverRequest = new ServerRequest(); |
|
| 252 | ||
| 253 | if ($method === null) { |
|
| 254 | $method = $serverRequest->getMethod(); |
|
| 255 | } |
|
| 256 | ||
| 257 | if ($route === null) { |
|
| 258 | $route = $serverRequest->getUri()->getPath(); |
|
| 259 | } |
|
| 260 | ||
| 261 | if ($this->basePath !== '' && strpos($route, $this->basePath, 0) === 0) { |
|
| 262 | $route = mb_substr($route, strlen($this->basePath)); |
|
| 263 | } |
|
| 264 | ||
| 265 | return $this->callCallable($this->getCallable($method, $route)); |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * Returns the callable to which the specied method and route are mapped. |
|