Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class PlatesRendererAdapter implements RendererAdapterInterface |
||
11 | { |
||
12 | protected Engine $engine; |
||
13 | |||
14 | 3 | public function __construct( |
|
15 | protected string $viewPath, |
||
16 | ) {} |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | 1 | public function exists(string $name): bool |
|
22 | { |
||
23 | 1 | return $this->getEngine()->exists($name); |
|
24 | } |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | 2 | public function render(string $name, array $params = []): string |
|
30 | { |
||
31 | 2 | return $this->getEngine()->render($name, $params); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Get the Plates template Engine. |
||
36 | */ |
||
37 | 3 | protected function getEngine(): Engine |
|
38 | { |
||
39 | 3 | return $this->engine ??= $this->createEngine(); |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Create the Plates template Engine. |
||
44 | */ |
||
45 | 3 | protected function createEngine(): Engine |
|
49 | } |
||
50 | } |
||
51 |