| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Routes implements GeneratorInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var DataProviderInterface |
||
| 14 | */ |
||
| 15 | private $provider; |
||
| 16 | |||
| 17 | 2 | public function __construct(DataProviderInterface $provider) |
|
| 18 | { |
||
| 19 | 2 | $this->provider = $provider; |
|
| 20 | 2 | } |
|
| 21 | |||
| 22 | /** |
||
| 23 | * @return string |
||
| 24 | * @throws \Twig_Error_Loader |
||
| 25 | * @throws \Twig_Error_Runtime |
||
| 26 | * @throws \Twig_Error_Syntax |
||
| 27 | */ |
||
| 28 | 1 | public function generate(): string |
|
| 29 | { |
||
| 30 | 1 | $loader = new FilesystemLoader(__DIR__); |
|
| 31 | 1 | $twig = new Environment($loader); |
|
| 32 | |||
| 33 | 1 | return $twig->load('RoutesDelegator.php.twig')->render($this->getParams()); |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | private function getParams(): array |
|
| 37 | { |
||
| 38 | return [ |
||
| 39 | 1 | 'ns' => $this->provider->getRoutesDelegatorNameSpace(), |
|
| 40 | 1 | 'controllerNs' => $this->provider->getControllerNameSpace(), |
|
| 41 | 1 | 'entityName' => $this->provider->getShortName(), |
|
| 42 | ]; |
||
| 43 | } |
||
| 44 | |||
| 45 | 2 | public function getClassName(): string |
|
| 48 | } |
||
| 49 | } |
||
| 50 |