Total Complexity | 3 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
5 | class Tpl |
||
6 | { |
||
7 | use ParseTpl; |
||
8 | |||
9 | public function render(string $view, array $data = []) : string |
||
10 | { |
||
11 | $content = $this->getContent(); |
||
12 | |||
13 | $this->data = array_merge($data, $this->data); |
||
14 | extract($this->data); |
||
15 | |||
16 | $tmp = tmpfile(); |
||
17 | |||
18 | if ($tmp !== false) { |
||
19 | fwrite($tmp, $content); |
||
20 | fseek($tmp, 0); |
||
21 | |||
22 | ob_start(); |
||
23 | $file = stream_get_meta_data($tmp); |
||
24 | |||
25 | include $file['uri']; |
||
26 | $content = ob_get_clean(); |
||
27 | fclose($tmp); |
||
28 | } |
||
29 | return $content; |
||
30 | } |
||
31 | |||
32 | private function getContent() |
||
43 | } |
||
44 | } |
||
45 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.