1 | <?php |
||
17 | class HtmlReport implements ReportInterface |
||
|
|||
18 | { |
||
19 | /** |
||
20 | * @var \Twig_Environment |
||
21 | */ |
||
22 | private $twig; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $template; |
||
28 | |||
29 | /** |
||
30 | * HtmlReport constructor. |
||
31 | * @param string $templatesDir |
||
32 | * @param array $optionTwig |
||
33 | */ |
||
34 | 2 | public function __construct($templatesDir = '', $optionTwig = []) |
|
42 | |||
43 | /** |
||
44 | * Build html report. |
||
45 | * |
||
46 | * @param DocumentInterface $document |
||
47 | * @param array $parameters |
||
48 | * @return bool|string |
||
49 | */ |
||
50 | 2 | public function render(DocumentInterface $document, $parameters = []) |
|
51 | { |
||
52 | 2 | $html = $this->twig->render($this->template, [ |
|
53 | 2 | 'doc' => $document, |
|
54 | 'params' => $parameters |
||
55 | 2 | ]); |
|
56 | |||
57 | 2 | return $html; |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * Set filename templte. |
||
62 | * |
||
63 | * @param string $template |
||
64 | */ |
||
65 | 2 | public function setTemplate($template) |
|
69 | } |