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