1 | <?php |
||
29 | abstract class Base extends \csphere\core\service\Drivers |
||
30 | { |
||
31 | /** |
||
32 | * Stores the cache object |
||
33 | **/ |
||
34 | protected $cache = null; |
||
35 | |||
36 | /** |
||
37 | * Stores the local path |
||
38 | **/ |
||
39 | protected $path = ''; |
||
40 | |||
41 | /** |
||
42 | * Stores the local path |
||
43 | **/ |
||
44 | private static $_count = []; |
||
45 | |||
46 | /** |
||
47 | * Creates the XML handler object |
||
48 | * |
||
49 | * @param array $config Configuration details as an array |
||
50 | * |
||
51 | * @return \csphere\core\xml\Base |
||
52 | **/ |
||
53 | |||
54 | public function __construct(array $config) |
||
62 | |||
63 | /** |
||
64 | * Try to find a source inside the cache or as a file |
||
65 | * |
||
66 | * @param string $type Type of target, e.g. plugin |
||
67 | * @param string $name Directory name of the target |
||
68 | * @param string $lang Language if more than one is possible |
||
69 | * @param boolean $empty Return empty array if file is missing |
||
70 | * |
||
71 | * @throws \Exception |
||
72 | * |
||
73 | * @return array |
||
74 | **/ |
||
75 | |||
76 | public function source($type, $name, $lang = 'en', $empty = false) |
||
115 | |||
116 | /** |
||
117 | * Transforms the given string to a driver specific array |
||
118 | * |
||
119 | * @param string $string String containing the XML content |
||
120 | * |
||
121 | * @return array |
||
122 | **/ |
||
123 | |||
124 | public function transform($string) |
||
134 | |||
135 | /** |
||
136 | * Converts a valid XML data string into arrays |
||
137 | * |
||
138 | * @param string $string The XML data string to use |
||
139 | * |
||
140 | * @throws \Exception |
||
141 | * |
||
142 | * @return array |
||
143 | **/ |
||
144 | |||
145 | private function _structure($string) |
||
179 | |||
180 | /** |
||
181 | * Format data as an usable array |
||
182 | * |
||
183 | * @param array $values Array with value data |
||
184 | * @param array $index Array with index data |
||
185 | * @param integer $start Start point of data loop |
||
186 | * @param integer $end End point of data loop |
||
187 | * |
||
188 | * @return array |
||
189 | **/ |
||
190 | |||
191 | private function _format(array $values, array $index, $start, $end) |
||
252 | |||
253 | /** |
||
254 | * Move attributes up to data array in a loop |
||
255 | * |
||
256 | * @param array $array Array to convert |
||
257 | * |
||
258 | * @return array |
||
259 | **/ |
||
260 | |||
261 | protected function loopattr(array $array) |
||
276 | |||
277 | /** |
||
278 | * Change array depth for common settings |
||
279 | * |
||
280 | * @param array $array Array to convert |
||
281 | * |
||
282 | * @return array |
||
283 | **/ |
||
284 | |||
285 | protected function common(array $array) |
||
308 | |||
309 | /** |
||
310 | * Determine the driver specific source file |
||
311 | * |
||
312 | * @param string $type Type of target, e.g. plugin |
||
313 | * @param string $name Directory name of the target |
||
314 | * @param string $lang Language if more than one is possible |
||
315 | * |
||
316 | * @return string |
||
317 | **/ |
||
318 | |||
319 | abstract protected function file($type, $name, $lang); |
||
320 | |||
321 | /** |
||
322 | * Change data array for easier usage |
||
323 | * |
||
324 | * @param array $array Formated array generated earlier |
||
325 | * |
||
326 | * @return array |
||
327 | **/ |
||
328 | |||
329 | abstract protected function change(array $array); |
||
330 | } |
||
331 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.