Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
9 | final class ApiRouting |
||
10 | { |
||
11 | /** |
||
12 | * |
||
13 | * @return Dispatcher |
||
14 | */ |
||
15 | public static function create(): Dispatcher |
||
16 | { |
||
17 | return cachedDispatcher(function (RouteCollector $r) |
||
18 | { |
||
19 | $r->get( '/tasks', ListTasks::class ); |
||
20 | $r->post( '/tasks', AddTask::class ); |
||
21 | $r->get( '/task/{identifier}', ShowTask::class ); |
||
22 | |||
23 | }, [ |
||
24 | 'cacheFile' => self::getRoutingCachePath(), |
||
25 | 'cacheDisabled' => 'prod' === getenv('JOBQUEUE_ENV') ? false : true, |
||
26 | ]); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | private static function getRoutingCachePath(): string |
||
41 | } |
||
42 | } |
||
43 |