Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class RestGroupFactory |
||
14 | { |
||
15 | private const ENTITY_PATTERN = '{id:\d+}'; |
||
16 | |||
17 | private const METHODS = [ |
||
18 | 'get' => Method::GET, |
||
19 | 'list' => Method::GET, |
||
20 | 'post' => Method::POST, |
||
21 | 'put' => Method::PUT, |
||
22 | 'delete' => Method::DELETE, |
||
23 | 'patch' => Method::PATCH, |
||
24 | 'head' => Method::HEAD, |
||
25 | 'options' => Method::OPTIONS, |
||
26 | ]; |
||
27 | |||
28 | public static function create(string $prefix, string $controller): RouteCollectorInterface |
||
29 | { |
||
30 | return Group::create($prefix, self::createDefaultRoutes($controller)); |
||
31 | } |
||
32 | |||
33 | private static function createDefaultRoutes(string $controller): array |
||
45 | } |
||
46 | } |
||
47 |