Total Complexity | 7 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Template |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | private $_template = 'default'; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $_title = ''; |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | private $_properties = []; |
||
24 | |||
25 | /** |
||
26 | * Método para setear propiedades |
||
27 | * @param string $prop |
||
28 | * @param mixed $value |
||
29 | */ |
||
30 | public function set($prop, $value) |
||
31 | { |
||
32 | $this->_properties[$prop] = $value; |
||
33 | } |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Método para obtener propiedades |
||
38 | * @param string $prop |
||
39 | * @return mixed|null |
||
40 | */ |
||
41 | public function get($prop) |
||
42 | { |
||
43 | return isset($this->_properties[$prop]) ? $this->_properties[$prop] : null; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Permite asignar el template manualmente |
||
48 | * @param string $template |
||
49 | */ |
||
50 | public function setTemplate($template) |
||
51 | { |
||
52 | $this->_template = $template; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Permite asignar el title manualmente |
||
57 | * @param string $title |
||
58 | */ |
||
59 | public function setTitle($title) |
||
62 | } |
||
63 | |||
64 | |||
65 | |||
66 | /** |
||
67 | * Permite renderizar una vista dentro de la plantilla |
||
68 | * @param string $view |
||
69 | */ |
||
70 | public function render($view) |
||
84 | } |