1 | <?php |
||
12 | class View |
||
13 | { |
||
14 | private $renderer; |
||
15 | private $template; |
||
16 | private $params = []; |
||
17 | |||
18 | private static $intance; |
||
19 | |||
20 | public static function getInstance() |
||
28 | |||
29 | public function __construct() |
||
51 | |||
52 | /** |
||
53 | * Render the view specified. |
||
54 | * |
||
55 | * @param string $view |
||
56 | */ |
||
57 | public function render($view = null, $params = null) |
||
63 | |||
64 | /** |
||
65 | * Set the view file to be rendered. |
||
66 | * |
||
67 | * @param string $template |
||
68 | */ |
||
69 | public function setView($template) |
||
73 | |||
74 | /** |
||
75 | * Adds a parameter in the view. |
||
76 | * |
||
77 | * @param string $name |
||
78 | * @param mixed $value |
||
79 | */ |
||
80 | public function addParam($name, $value) |
||
84 | |||
85 | /** |
||
86 | * Add array parameters in view, each position of the array will become a variable |
||
87 | * available to the view. |
||
88 | * |
||
89 | * @param array $array |
||
90 | */ |
||
91 | public function addParams($array) |
||
97 | |||
98 | /** |
||
99 | * Returns the specified parameter. |
||
100 | * |
||
101 | * @param string $name |
||
102 | * |
||
103 | * @return void|mixed |
||
104 | */ |
||
105 | public function getParam($name) |
||
113 | } |
||
114 |