1 | <?php |
||
18 | class HtmlReport implements ReportInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var \Twig_Environment |
||
22 | */ |
||
23 | private $twig; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $template = 'invoice.html.twig'; |
||
29 | |||
30 | /** |
||
31 | * HtmlReport constructor. |
||
32 | * |
||
33 | * @param string $templatesDir |
||
34 | * @param array $optionTwig |
||
35 | */ |
||
36 | 18 | public function __construct($templatesDir = '', $optionTwig = []) |
|
44 | |||
45 | /** |
||
46 | * Build html report. |
||
47 | * |
||
48 | * @param DocumentInterface $document |
||
49 | * @param array $parameters |
||
50 | * |
||
51 | * @return mixed |
||
52 | * |
||
53 | * @throws \Twig_Error_Loader |
||
54 | * @throws \Twig_Error_Runtime |
||
55 | * @throws \Twig_Error_Syntax |
||
56 | */ |
||
57 | 18 | public function render(DocumentInterface $document, $parameters = []) |
|
66 | |||
67 | /** |
||
68 | * Set filename templte. |
||
69 | * |
||
70 | * @param string $template |
||
71 | */ |
||
72 | 18 | public function setTemplate($template) |
|
76 | |||
77 | /** |
||
78 | * @return \Twig_Environment |
||
79 | */ |
||
80 | 18 | public function getTwig() |
|
84 | |||
85 | /** |
||
86 | * @param $directory |
||
87 | * @param $options |
||
88 | * |
||
89 | * @return \Twig_Environment |
||
90 | */ |
||
91 | 18 | private function buildTwig($directory, $options) |
|
103 | |||
104 | /** |
||
105 | * @param $directory |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | 18 | private function getDirectories($directory) |
|
119 | } |
||
120 |