Conditions | 4 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
31 | private static function createDefaultRoutes(string $controller): array |
||
32 | { |
||
33 | $routes = []; |
||
34 | $reflection = new ReflectionClass($controller); |
||
35 | foreach (self::METHODS as $methodName => $httpMethod) { |
||
36 | if ($reflection->hasMethod($methodName)) { |
||
37 | $pattern = $methodName === 'list' ? '' : self::ENTITY_PATTERN; |
||
38 | $routes[] = Route::methods([$httpMethod], $pattern)->action([$controller, $methodName]); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | return $routes; |
||
43 | } |
||
45 |