1 | <?php namespace PascalKleindienst\FormListGenerator\Support; |
||
7 | class View |
||
8 | { |
||
9 | /** |
||
10 | * @var null|string |
||
11 | */ |
||
12 | protected $path; |
||
13 | |||
14 | /** |
||
15 | * @var null|string |
||
16 | */ |
||
17 | protected $extension; |
||
18 | |||
19 | /** |
||
20 | * Set params |
||
21 | * |
||
22 | * @param string $path |
||
23 | * @param string $extension |
||
24 | */ |
||
25 | 60 | public function __construct($path = '', $extension = '.phtml') |
|
38 | |||
39 | /** |
||
40 | * Load a view file |
||
41 | * |
||
42 | * @param string $file |
||
43 | * @param array $data |
||
44 | * @return void |
||
45 | * @throws \InvalidArgumentException if the file could not be found |
||
46 | */ |
||
47 | 21 | public function render($file, array $data = []) |
|
60 | |||
61 | /** |
||
62 | * Get the full file name |
||
63 | * |
||
64 | * @param string $file |
||
65 | * @return string |
||
66 | */ |
||
67 | 21 | protected function getFileName($file) |
|
71 | |||
72 | /** |
||
73 | * Return path |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | 9 | public function getPath() |
|
81 | } |
||
82 |