1 | <?php |
||
16 | class Twig implements \ArrayAccess |
||
17 | { |
||
18 | /** |
||
19 | * Twig loader |
||
20 | * |
||
21 | * @var \Twig\Loader\LoaderInterface |
||
22 | */ |
||
23 | protected $loader; |
||
24 | /** |
||
25 | * Twig environment |
||
26 | * |
||
27 | * @var \Twig\Environment |
||
28 | */ |
||
29 | protected $environment; |
||
30 | /** |
||
31 | * Default view variables |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $defaultVariables = []; |
||
36 | /******************************************************************************** |
||
37 | * Constructors and service provider registration |
||
38 | *******************************************************************************/ |
||
39 | /** |
||
40 | * Create new Twig view |
||
41 | * |
||
42 | * @param string|array $path Path(s) to templates directory |
||
43 | * @param array $settings Twig environment settings |
||
44 | */ |
||
45 | public function __construct($path, $settings = []) |
||
50 | /******************************************************************************** |
||
51 | * Methods |
||
52 | *******************************************************************************/ |
||
53 | /** |
||
54 | * Proxy method to add an extension to the Twig environment |
||
55 | * |
||
56 | * @param \Twig\Extension\ExtensionInterface $extension A single extension instance or an array of instances |
||
57 | */ |
||
58 | public function addExtension(\Twig\Extension\ExtensionInterface $extension) |
||
62 | /** |
||
63 | * Fetch rendered template |
||
64 | * |
||
65 | * @param string $template Template pathname relative to templates directory |
||
66 | * @param array $data Associative array of template variables |
||
67 | * |
||
68 | * @throws \Twig\Error\LoaderError When the template cannot be found |
||
69 | * @throws \Twig\Error\SyntaxError When an error occurred during compilation |
||
70 | * @throws \Twig\Error\RuntimeError When an error occurred during rendering |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function fetch($template, $data = []) |
||
79 | /** |
||
80 | * Fetch rendered block |
||
81 | * |
||
82 | * @param string $template Template pathname relative to templates directory |
||
83 | * @param string $block Name of the block within the template |
||
84 | * @param array $data Associative array of template variables |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function fetchBlock($template, $block, $data = []) |
||
93 | /** |
||
94 | * Fetch rendered string |
||
95 | * |
||
96 | * @param string $string String |
||
97 | * @param array $data Associative array of template variables |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | public function fetchFromString($string ="", $data = []) |
||
106 | /** |
||
107 | * Output rendered template |
||
108 | * |
||
109 | * @param ResponseInterface $response |
||
110 | * @param string $template Template pathname relative to templates directory |
||
111 | * @param array $data Associative array of template variables |
||
112 | * @return ResponseInterface |
||
113 | */ |
||
114 | public function render(ResponseInterface $response, $template, $data = []) |
||
119 | /** |
||
120 | * Create a loader with the given path |
||
121 | * |
||
122 | * @param array $paths |
||
123 | * @return \Twig\Loader\FilesystemLoader |
||
124 | */ |
||
125 | private function createLoader(array $paths) |
||
137 | /******************************************************************************** |
||
138 | * Accessors |
||
139 | *******************************************************************************/ |
||
140 | /** |
||
141 | * Return Twig loader |
||
142 | * |
||
143 | * @return \Twig\Loader\LoaderInterface |
||
144 | */ |
||
145 | public function getLoader() |
||
149 | /** |
||
150 | * Return Twig environment |
||
151 | * |
||
152 | * @return \Twig\Environment |
||
153 | */ |
||
154 | public function getEnvironment() |
||
158 | /******************************************************************************** |
||
159 | * ArrayAccess interface |
||
160 | *******************************************************************************/ |
||
161 | /** |
||
162 | * Does this collection have a given key? |
||
163 | * |
||
164 | * @param string $key The data key |
||
165 | * |
||
166 | * @return bool |
||
167 | */ |
||
168 | public function offsetExists($key) |
||
172 | /** |
||
173 | * Get collection item for key |
||
174 | * |
||
175 | * @param string $key The data key |
||
176 | * |
||
177 | * @return mixed The key's value, or the default value |
||
178 | */ |
||
179 | public function offsetGet($key) |
||
183 | /** |
||
184 | * Set collection item |
||
185 | * |
||
186 | * @param string $key The data key |
||
187 | * @param mixed $value The data value |
||
188 | */ |
||
189 | public function offsetSet($key, $value) |
||
193 | /** |
||
194 | * Remove item from collection |
||
195 | * |
||
196 | * @param string $key The data key |
||
197 | */ |
||
198 | public function offsetUnset($key) |
||
202 | /******************************************************************************** |
||
203 | * Countable interface |
||
204 | *******************************************************************************/ |
||
205 | /** |
||
206 | * Get number of items in collection |
||
207 | * |
||
208 | * @return int |
||
209 | */ |
||
210 | public function count() |
||
214 | /******************************************************************************** |
||
215 | * IteratorAggregate interface |
||
216 | *******************************************************************************/ |
||
217 | /** |
||
218 | * Get collection iterator |
||
219 | * |
||
220 | * @return \ArrayIterator |
||
221 | */ |
||
222 | public function getIterator() |
||
226 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..