| Conditions | 5 |
| Paths | 5 |
| Total Lines | 30 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 5 |
| Changes | 6 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 32 | 2 | public function capabilitiesAction() |
|
| 33 | { |
||
| 34 | 2 | $routes = $this->router->getRouteCollection(); |
|
| 35 | 2 | $exposed = []; |
|
| 36 | |||
| 37 | 2 | foreach ($routes as $name => $route) { |
|
| 38 | 2 | if (!$route->hasDefault(RouteKeys::DEFINITION)) { |
|
| 39 | 2 | continue; |
|
| 40 | } |
||
| 41 | |||
| 42 | 2 | if (!in_array('OPTIONS', $route->getMethods(), true)) { |
|
| 43 | 2 | continue; |
|
| 44 | } |
||
| 45 | |||
| 46 | 2 | $definition = $route->getDefault(RouteKeys::DEFINITION); |
|
| 47 | 2 | list($collection, $resource) = explode('::', $definition); |
|
| 48 | 2 | $definition = $this |
|
| 49 | ->registry |
||
| 50 | 2 | ->getCollection($collection) |
|
| 51 | 2 | ->getResource($resource); |
|
| 52 | |||
| 53 | 2 | if ($definition->hasOption('private')) { |
|
| 54 | 2 | continue; |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | $exposed[$name] = $route; |
|
| 58 | 2 | } |
|
| 59 | |||
| 60 | 2 | return $exposed; |
|
| 61 | } |
||
| 62 | } |
||
| 63 |