| Conditions | 4 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function register(Engine $engine) |
||
| 22 | { |
||
| 23 | $engine->registerFunction('load', function (...$arguments) use ($engine) { |
||
| 24 | $view = array_shift($arguments); |
||
| 25 | $variables = array_shift($arguments); |
||
| 26 | $return = array_shift($arguments); |
||
| 27 | if (is_array($view)) { |
||
| 28 | $view = $engine->buildPath($view); |
||
|
|
|||
| 29 | } |
||
| 30 | $variables = is_array($variables) ? $variables : []; |
||
| 31 | |||
| 32 | $content = $engine->getContents($view, $variables); |
||
| 33 | if ($return === true) { |
||
| 34 | return $content; |
||
| 35 | } |
||
| 36 | echo $content; |
||
| 37 | }); |
||
| 40 |