Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public static function load(string $location, array $variables = []): string |
||
19 | { |
||
20 | if (\file_exists($location)) { |
||
21 | if (pathinfo($location, PATHINFO_EXTENSION) === 'php') { |
||
22 | ob_start(); |
||
23 | extract($variables); |
||
24 | include $location; |
||
25 | return ob_get_clean(); |
||
26 | } else { |
||
27 | return \file_get_contents($location); |
||
28 | } |
||
29 | } |
||
30 | throw new TemplateNotFoundException($location . ': template not found'); |
||
31 | } |
||
33 |