| 1 | <?php |
||
| 11 | class ViewRenderFile implements |
||
| 12 | ViewRenderFileInterface, |
||
| 13 | ContainerInjectableInterface |
||
| 14 | { |
||
| 15 | use ContainerInjectableTrait; |
||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | /** |
||
| 20 | * Render the view file. |
||
| 21 | * |
||
| 22 | * @param string $file to include as view file. |
||
| 23 | * @param array $data to expose within the view. |
||
| 24 | * |
||
| 25 | * @throws \Anax\View\Exception when template file is not found. |
||
| 26 | * |
||
| 27 | * @return void |
||
| 28 | */ |
||
| 29 | public function render(string $file, array $data) : void |
||
| 43 | } |
||
| 44 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: