Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class View extends Template |
||
15 | { |
||
16 | /** |
||
17 | * Cria uma View com base no arquivo escolhido |
||
18 | * @param string $file arquivo da View |
||
19 | */ |
||
20 | public function __construct($file) |
||
21 | { |
||
22 | Application::app()->view = $this; |
||
23 | $controller = Application::app()->controller; |
||
24 | $data = get_object_vars($controller); |
||
25 | parent::__construct($file, $data, 'shared/' . $controller->layout); |
||
26 | $this->validateFile(); |
||
27 | } |
||
28 | |||
29 | private function validateFile() |
||
30 | { |
||
31 | if (!$this->exists()) { |
||
32 | throw new HttpException("View '{$this->file}' not found", 404); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | /** @return string */ |
||
37 | public function getTitle() |
||
40 | } |
||
41 | } |
||
42 |