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