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