Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
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 | } |
||
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.