1 | <?php |
||
12 | class StructureManager |
||
13 | { |
||
14 | /** |
||
15 | * PHP does not allow use of function names |
||
16 | * such as 'list' or 'array' |
||
17 | */ |
||
18 | const ARRAY_STANDARD = 's_array'; |
||
19 | const ARRAY_PHP = 's_phpArray'; |
||
20 | const ARRAY_LIST = 's_list1'; |
||
21 | const ARRAY_LIST2 = 's_list2'; |
||
22 | const ARRAY_MATRIX = 's_matrix'; |
||
23 | |||
24 | /** |
||
25 | * Static calls interface |
||
26 | */ |
||
27 | public static function __callstatic($name, $params) |
||
39 | |||
40 | /** |
||
41 | * Get implemented data structures display |
||
42 | * |
||
43 | * @return string[] |
||
44 | */ |
||
45 | public static function getDisplayableStructures() |
||
57 | |||
58 | /** |
||
59 | * Render array displayed as structure |
||
60 | * |
||
61 | * @param array $array |
||
62 | * @param Structure $structure |
||
63 | * |
||
64 | * @return string |
||
65 | * @throws Exception |
||
66 | */ |
||
67 | public static function buildStructure($array, Structure $structure) |
||
82 | |||
83 | /** |
||
84 | * Shortcut to render a list |
||
85 | * |
||
86 | * @param $list |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | private static function __s_list1($list) |
||
96 | |||
97 | /** |
||
98 | * Shortcut to render a list |
||
99 | * |
||
100 | * @param $list |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | private static function __s_list2($list) |
||
110 | |||
111 | /** |
||
112 | * Shortcut to render an array with borders |
||
113 | * |
||
114 | * @param $array |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | private static function __s_array($array) |
||
125 | |||
126 | /** |
||
127 | * Shortcut to render an array as a php array declaration |
||
128 | * |
||
129 | * @param $array |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | private static function __s_phpArray($array) |
||
139 | |||
140 | /** |
||
141 | * Shortcut to render a matrix |
||
142 | * |
||
143 | * @param $array |
||
144 | * |
||
145 | * @throws \RuntimeException |
||
146 | */ |
||
147 | private static function __s_matrix($array) |
||
151 | |||
152 | /** |
||
153 | * Render a structure of type 'list |
||
154 | * |
||
155 | * @param array $list |
||
156 | * @param Structure $structure |
||
157 | * |
||
158 | * @return string |
||
159 | */ |
||
160 | private static function buildList(array $list, Structure $structure) |
||
171 | |||
172 | /** |
||
173 | * Render a structure of type 'array' |
||
174 | * |
||
175 | * @param array $array |
||
176 | * @param Structure $structure |
||
177 | * |
||
178 | * @return string |
||
179 | */ |
||
180 | private static function buildArray(array $array, Structure $structure) |
||
206 | |||
207 | /** |
||
208 | * @param Border $border |
||
209 | * @param int $maxKeyLength |
||
210 | * @param int $maxValueLength |
||
211 | * |
||
212 | * @return string |
||
213 | */ |
||
214 | private static function printBorder(Border $border, $maxKeyLength, $maxValueLength) |
||
226 | |||
227 | /** |
||
228 | * @param string $key |
||
229 | * @param string $value |
||
230 | * @param Structure $structure |
||
231 | * @param int $maxKeyLength |
||
232 | * @param int $maxValueLength |
||
233 | * |
||
234 | * @return string |
||
235 | */ |
||
236 | private static function printStructureLine($key, $value, Structure $structure, $maxKeyLength, $maxValueLength) |
||
268 | } |
||
269 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.