1 | <?php |
||
17 | class TwigFileRepository implements RepositoryInterface |
||
18 | { |
||
19 | /** |
||
20 | * Twig template |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $template; |
||
25 | |||
26 | /** |
||
27 | * @var Twig_Environment |
||
28 | */ |
||
29 | protected $twig; |
||
30 | |||
31 | /** |
||
32 | * TwigFileRepository constructor. |
||
33 | * |
||
34 | * @param Twig_Environment $twig |
||
35 | */ |
||
36 | public function __construct(Twig_Environment $twig) |
||
40 | |||
41 | /** |
||
42 | * Get subject template |
||
43 | * |
||
44 | * @param array $data |
||
45 | * |
||
46 | * @return string |
||
47 | * |
||
48 | * @throws \Throwable |
||
49 | */ |
||
50 | public function getSubjectTemplate(array $data): string |
||
54 | |||
55 | /** |
||
56 | * Get body template |
||
57 | * |
||
58 | * @param array $data |
||
59 | * |
||
60 | * @return string |
||
61 | * |
||
62 | * @throws \Throwable |
||
63 | */ |
||
64 | public function getBodyTemplate(array $data): string |
||
68 | |||
69 | /** |
||
70 | * Get sender name template |
||
71 | * |
||
72 | * @param array $data |
||
73 | * |
||
74 | * @return string |
||
75 | * |
||
76 | * @throws \Throwable |
||
77 | */ |
||
78 | public function getSenderNameTemplate(array $data): string |
||
86 | |||
87 | /** |
||
88 | * Get sender email template |
||
89 | * |
||
90 | * @param array $data |
||
91 | * |
||
92 | * @return string |
||
93 | * |
||
94 | * @throws \Throwable |
||
95 | */ |
||
96 | public function getSenderEmailTemplate(array $data): string |
||
104 | |||
105 | /** |
||
106 | * Render twig template |
||
107 | * |
||
108 | * @param string $block |
||
109 | * @param array $data |
||
110 | * |
||
111 | * @return string |
||
112 | * |
||
113 | * @throws \Throwable |
||
114 | */ |
||
115 | protected function renderBlock(string $block, array $data): string |
||
123 | |||
124 | /** |
||
125 | * Load template file |
||
126 | * |
||
127 | * @param string $directory |
||
128 | * |
||
129 | * @return \Twig_TemplateWrapper |
||
130 | * |
||
131 | * @throws RepositoryUnavailableException |
||
132 | */ |
||
133 | protected function loadTemplate(string $directory) |
||
146 | |||
147 | /** |
||
148 | * Repository initialize |
||
149 | * |
||
150 | * @param TemplateInterface $template |
||
151 | * @param array $arguments |
||
152 | * |
||
153 | * @throws RepositoryUnavailableException |
||
154 | * @throws \ReflectionException |
||
155 | */ |
||
156 | public function connect(TemplateInterface $template, array $arguments = []) |
||
163 | } |
||
164 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.