Total Complexity | 3 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
12 | class MustacheEngine extends AbstractEngine |
||
13 | { |
||
14 | private $stringRenderingEngine; |
||
15 | private $fileRenderingEngine; |
||
16 | |||
17 | public function __construct(Mustache_Engine $stringRenderingEngine, Mustache_Engine $fileRenderingEngine) |
||
18 | { |
||
19 | $this->stringRenderingEngine = $stringRenderingEngine; |
||
20 | $this->fileRenderingEngine = $fileRenderingEngine; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Passes the data to be rendered to the template engine instance. |
||
25 | * @param string $filePath |
||
26 | * @param array $data |
||
27 | * @return string |
||
28 | */ |
||
29 | public function renderFromFileTemplate(string $filePath, array $data): string |
||
30 | { |
||
31 | return $this->fileRenderingEngine->render($filePath, $data); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Passes a template string and data to be rendered to the template engine |
||
36 | * instance. |
||
37 | * @param string $string |
||
38 | * @param array $data |
||
39 | * @return string |
||
40 | */ |
||
41 | public function renderFromStringTemplate(string $string, array $data): string |
||
44 | } |
||
45 | } |
||
46 |