Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
23 | public function make(string $name, array $data = [], int $httpStatus = 200, array $httpHeaders = []) |
||
24 | { |
||
25 | $file = str_replace('.', DIRECTORY_SEPARATOR, $name) . '.phtml'; |
||
26 | $path = join('/', [$this->directory, $file]); |
||
27 | |||
28 | http_response_code($httpStatus); |
||
29 | |||
30 | foreach ($httpHeaders as $name => $values) { |
||
31 | @header($name . ': ' . $values); |
||
32 | } |
||
33 | |||
34 | extract($data); |
||
35 | |||
36 | require $path; |
||
37 | |||
38 | return null; |
||
39 | } |
||
40 | } |
If you suppress an error, we recommend checking for the error condition explicitly: