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