Conditions | 3 |
Paths | 3 |
Total Lines | 29 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
56 | protected function renderFile(string $file): string |
||
57 | { |
||
58 | if (!is_readable($file)) { |
||
59 | throw new \InvalidArgumentException(sprintf('File "%s" is nonexistent (Working directory: %s)', $file, getcwd())); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Start the output buffer and require file |
||
64 | */ |
||
65 | ob_start(); |
||
66 | |||
67 | /** |
||
68 | * Prepare set variables for the view |
||
69 | * |
||
70 | * @todo Helpers, `$this->loadHelpers();` |
||
71 | */ |
||
72 | foreach ($this->variables as $variable => $value) { |
||
73 | $$variable = $value; |
||
74 | } |
||
75 | |||
76 | require $file; |
||
77 | |||
78 | /** |
||
79 | * Clean the output buffer and return |
||
80 | */ |
||
81 | $output = ob_get_clean(); |
||
82 | |||
83 | return $output; |
||
84 | } |
||
85 | } |
||
86 |