| Conditions | 4 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | private function methods(Request $request): array |
||
| 41 | { |
||
| 42 | $methods = []; |
||
| 43 | |||
| 44 | if ($route = $request->getAttribute('route')) { |
||
| 45 | $pattern = $route->getPattern(); |
||
| 46 | |||
| 47 | $router = $this->container->get('router'); |
||
| 48 | foreach ($router->getRoutes() as $route) { |
||
| 49 | if ($pattern === $route->getPattern()) { |
||
| 50 | $methods = array_merge_recursive($methods, $route->getMethods()); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | } else { |
||
| 54 | // Methods holds all of the HTTP Verbs that a particular route handles. |
||
| 55 | $methods[] = $request->getMethod(); |
||
| 56 | } |
||
| 57 | return $methods; |
||
| 58 | } |
||
| 60 |