| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 21 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class RouteList implements Arrayable |
||
| 17 | { |
||
| 18 | protected array $routes; |
||
| 19 | |||
| 20 | public function __construct() |
||
| 21 | { |
||
| 22 | $this->routes = $this->generate(); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function toArray(): array |
||
| 26 | { |
||
| 27 | return $this->routes; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function headers(): array |
||
| 31 | { |
||
| 32 | return array_map(function (string $key): string { |
||
| 33 | return ucwords(str_replace('_', ' ', $key)); |
||
| 34 | }, array_keys($this->routes[0])); |
||
| 35 | } |
||
| 36 | |||
| 37 | protected function generate(): array |
||
| 38 | { |
||
| 39 | return collect(Hyde::routes())->map(function (Route $route): array { |
||
| 40 | return $this->routeToListItem($route)->toArray(); |
||
| 41 | })->values()->toArray(); |
||
| 42 | } |
||
| 43 | |||
| 44 | protected static function routeToListItem(Route $route): RouteListItem |
||
| 47 | } |
||
| 48 | } |
||
| 49 |