Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
36 / 36 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| CodeRouteDefinitionProvider | |
100.00% |
36 / 36 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getGlobalRoutes | |
100.00% |
19 / 19 |
|
100.00% |
1 / 1 |
1 | |||
| getActionsForBoundedContext | |
100.00% |
17 / 17 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\TypescriptClientBuilder\RouteDefinitions; |
| 3 | |
| 4 | use Apie\Common\Interfaces\GlobalRouteDefinitionProviderInterface; |
| 5 | use Apie\Common\RouteDefinitions\ActionHashmap; |
| 6 | use Apie\Core\BoundedContext\BoundedContext; |
| 7 | use Apie\Core\Context\ApieContext; |
| 8 | |
| 9 | class CodeRouteDefinitionProvider implements GlobalRouteDefinitionProviderInterface |
| 10 | { |
| 11 | public function getGlobalRoutes(): ActionHashmap |
| 12 | { |
| 13 | $routes = []; |
| 14 | $definition = new Es6ModuleRoute(); |
| 15 | $routes[$definition->getOperationId()] = $definition; |
| 16 | $definition = new StaticContentRoute( |
| 17 | __DIR__ . '/../../resources', |
| 18 | '/js/contents/ts' |
| 19 | ); |
| 20 | $routes[$definition->getOperationId()] = $definition; |
| 21 | $definition = new StaticContentRoute( |
| 22 | __DIR__ . '/../../dist/es6', |
| 23 | '/js/contents/es6' |
| 24 | ); |
| 25 | $routes[$definition->getOperationId()] = $definition; |
| 26 | $definition = new StaticContentRoute( |
| 27 | __DIR__ . '/../../dist/es5', |
| 28 | '/js/contents/es5' |
| 29 | ); |
| 30 | $routes[$definition->getOperationId()] = $definition; |
| 31 | return new ActionHashmap($routes); |
| 32 | } |
| 33 | |
| 34 | public function getActionsForBoundedContext(BoundedContext $boundedContext, ApieContext $apieContext): ActionHashmap |
| 35 | { |
| 36 | $routes = []; |
| 37 | $definition = new StaticContentRoute( |
| 38 | __DIR__ . '/../../resources', |
| 39 | '/js/contents/ts' |
| 40 | ); |
| 41 | $routes[$definition->getOperationId()] = $definition; |
| 42 | $definition = new StaticContentRoute( |
| 43 | __DIR__ . '/../../dist', |
| 44 | '/js/contents/es6' |
| 45 | ); |
| 46 | $routes[$definition->getOperationId()] = $definition; |
| 47 | $definition = new StaticContentRoute( |
| 48 | __DIR__ . '/../../dist/es5', |
| 49 | '/js/contents/es5' |
| 50 | ); |
| 51 | $routes[$definition->getOperationId()] = $definition; |
| 52 | return new ActionHashmap($routes); |
| 53 | } |
| 54 | } |