1 | <?php |
||
20 | class Compose implements \Aimeos\MW\View\Iface |
||
21 | { |
||
22 | private $engines; |
||
23 | |||
24 | |||
25 | /** |
||
26 | * Initializes the logger object. |
||
27 | * |
||
28 | * @param array $engines Associative list of file name extensions as keys and view objects as values |
||
29 | */ |
||
30 | public function __construct( array $engines ) |
||
36 | |||
37 | |||
38 | /** |
||
39 | * Calls the view helper with the given name and arguments and returns it's output. |
||
40 | * |
||
41 | * @param string $name Name of the view helper |
||
42 | * @param array $args Arguments passed to the view helper |
||
43 | * @return mixed Output depending on the view helper |
||
44 | */ |
||
45 | public function __call( $name, array $args ) |
||
54 | |||
55 | |||
56 | /** |
||
57 | * Returns the value associated to the given key. |
||
58 | * |
||
59 | * @param string $key Name of the value that should be returned |
||
60 | * @return mixed Value associated to the given key |
||
61 | * @throws \Aimeos\MW\View\Exception If the requested key isn't available |
||
62 | */ |
||
63 | public function __get( $key ) |
||
74 | |||
75 | |||
76 | /** |
||
77 | * Tests if a key with the given name exists. |
||
78 | * |
||
79 | * @param string $key Name of the value that should be tested |
||
80 | * @return boolean True if the key exists, false if not |
||
81 | */ |
||
82 | public function __isset( $key ) |
||
93 | |||
94 | |||
95 | /** |
||
96 | * Removes a key from the stored values. |
||
97 | * |
||
98 | * @param string $key Name of the value that should be removed |
||
99 | * @return void |
||
100 | */ |
||
101 | public function __unset( $key ) |
||
107 | |||
108 | |||
109 | /** |
||
110 | * Sets a new value for the given key. |
||
111 | * |
||
112 | * @param string $key Name of the value that should be set |
||
113 | * @param mixed $value Value associated to the given key |
||
114 | * @return void |
||
115 | */ |
||
116 | public function __set( $key, $value ) |
||
122 | |||
123 | |||
124 | /** |
||
125 | * Adds a view helper instance to the view. |
||
126 | * |
||
127 | * @param string $name Name of the view helper as called in the template |
||
128 | * @param \Aimeos\MW\View\Helper\Iface $helper View helper instance |
||
129 | * @return void |
||
130 | */ |
||
131 | public function addHelper( $name, \Aimeos\MW\View\Helper\Iface $helper ) |
||
137 | |||
138 | |||
139 | /** |
||
140 | * Assigns a whole set of values at once to the view. |
||
141 | * This method overwrites already existing key/value pairs set by the magic method. |
||
142 | * |
||
143 | * @param array $values Associative list of key/value pairs |
||
144 | * @return void |
||
145 | */ |
||
146 | public function assign( array $values ) |
||
152 | |||
153 | |||
154 | /** |
||
155 | * Returns the value associated to the given key or the default value if the key is not available. |
||
156 | * |
||
157 | * @param string $key Name of the value that should be returned |
||
158 | * @param mixed $default Default value returned if ths key is not available |
||
159 | * @return mixed Value associated to the given key or the default value |
||
160 | */ |
||
161 | public function get( $key, $default = null ) |
||
172 | |||
173 | |||
174 | /** |
||
175 | * Renders the output based on the given template file name and the key/value pairs. |
||
176 | * |
||
177 | * @param string $filename File name of the view template |
||
178 | * @return string Output generated by the template |
||
179 | * @throws \Aimeos\MW\View\Exception If the template isn't found |
||
180 | */ |
||
181 | public function render( $filename ) |
||
185 | |||
186 | |||
187 | /** |
||
188 | * Returns the view engine suitable for the given file name |
||
189 | * |
||
190 | * @param string $filename Name of the template file including the file extension |
||
191 | * @return \Aimeos\MW\View\Iface View engine |
||
192 | * @throws \Aimeos\MW\View\Exception If no registered view engine for this file extension is found |
||
193 | */ |
||
194 | protected function getEngine( $filename ) |
||
208 | } |
||
209 |