1 | <?php |
||
13 | class Template |
||
14 | { |
||
15 | /** |
||
16 | * Instance of the template engine. |
||
17 | * @var Engine |
||
18 | */ |
||
19 | protected $engine; |
||
20 | |||
21 | /** |
||
22 | * The name of the template. |
||
23 | * @var Name |
||
24 | */ |
||
25 | protected $name; |
||
26 | |||
27 | /** |
||
28 | * The data assigned to the template. |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $data = array(); |
||
32 | |||
33 | /** |
||
34 | * An array of section content. |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $sections = array(); |
||
38 | |||
39 | /** |
||
40 | * The name of the template layout. |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $layoutName; |
||
44 | |||
45 | /** |
||
46 | * The data assigned to the template layout. |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $layoutData; |
||
50 | |||
51 | /** |
||
52 | * Create new Template instance. |
||
53 | * @param Engine $engine |
||
54 | * @param string $name |
||
55 | */ |
||
56 | 104 | public function __construct(Engine $engine, $name) |
|
63 | |||
64 | /** |
||
65 | * Magic method used to call extension functions. |
||
66 | * @param string $name |
||
67 | * @param array $arguments |
||
68 | * @return mixed |
||
69 | */ |
||
70 | 8 | public function __call($name, $arguments) |
|
74 | |||
75 | /** |
||
76 | * Alias for render() method. |
||
77 | * @param array $data |
||
|
|||
78 | * @throws \Throwable |
||
79 | * @throws \Exception |
||
80 | * @return string |
||
81 | */ |
||
82 | 4 | public function __toString() |
|
86 | |||
87 | /** |
||
88 | * Assign data to template object. |
||
89 | * @param array $data |
||
90 | * @return null |
||
91 | */ |
||
92 | 104 | public function data(array $data) |
|
96 | |||
97 | /** |
||
98 | * Check if the template exists. |
||
99 | * @return boolean |
||
100 | */ |
||
101 | 92 | public function exists() |
|
105 | |||
106 | /** |
||
107 | * Get the template path. |
||
108 | * @return string |
||
109 | */ |
||
110 | 88 | public function path() |
|
114 | |||
115 | /** |
||
116 | * Render the template and layout. |
||
117 | * @param array $data |
||
118 | * @throws \Throwable |
||
119 | * @throws \Exception |
||
120 | * @return string |
||
121 | */ |
||
122 | 84 | public function render(array $data = array()) |
|
158 | |||
159 | /** |
||
160 | * Set the template's layout. |
||
161 | * @param string $name |
||
162 | * @param array $data |
||
163 | * @return null |
||
164 | */ |
||
165 | 12 | public function layout($name, array $data = array()) |
|
170 | |||
171 | /** |
||
172 | * Start a new section block. |
||
173 | * @param string $name |
||
174 | * @return null |
||
175 | */ |
||
176 | 8 | public function start($name) |
|
188 | |||
189 | /** |
||
190 | * Stop the current section block. |
||
191 | * @return null |
||
192 | */ |
||
193 | 8 | public function stop() |
|
205 | |||
206 | /** |
||
207 | * Returns the content for a section block. |
||
208 | * @param string $name Section name |
||
209 | * @param string $default Default section content |
||
210 | * @return string|null |
||
211 | */ |
||
212 | 12 | public function section($name, $default = null) |
|
220 | |||
221 | /** |
||
222 | * Fetch a rendered template. |
||
223 | * @param string $name |
||
224 | * @param array $data |
||
225 | * @return string |
||
226 | */ |
||
227 | 4 | public function fetch($name, array $data = array()) |
|
231 | |||
232 | /** |
||
233 | * Output a rendered template. |
||
234 | * @param string $name |
||
235 | * @param array $data |
||
236 | * @return null |
||
237 | */ |
||
238 | 4 | public function insert($name, array $data = array()) |
|
242 | |||
243 | /** |
||
244 | * Apply multiple functions to variable. |
||
245 | * @param mixed $var |
||
246 | * @param string $functions |
||
247 | * @return mixed |
||
248 | */ |
||
249 | 12 | public function batch($var, $functions) |
|
265 | |||
266 | /** |
||
267 | * Escape string. |
||
268 | * @param string $string |
||
269 | * @param null|string $functions |
||
270 | * @return string |
||
271 | */ |
||
272 | 12 | public function escape($string, $functions = null) |
|
286 | |||
287 | /** |
||
288 | * Alias to escape function. |
||
289 | * @param string $string |
||
290 | * @param null|string $functions |
||
291 | * @return string |
||
292 | */ |
||
293 | 4 | public function e($string, $functions = null) |
|
297 | } |
||
298 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.