Conditions | 5 |
Paths | 6 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5.009 |
Changes | 0 |
1 | <?php |
||
12 | 2 | public static function fromArray(array $array): string |
|
13 | { |
||
14 | 2 | if (empty($array)) { |
|
15 | return ''; |
||
16 | } |
||
17 | |||
18 | 2 | $output = '<ul class="list-tree text-monospace">'; |
|
19 | |||
20 | 2 | foreach ($array as $key => $value) { |
|
21 | 2 | $output .= '<li>'; |
|
22 | |||
23 | 2 | if ($key === 'password') { |
|
24 | 2 | $value = '********'; |
|
25 | } |
||
26 | |||
27 | 2 | if (is_array($value)) { |
|
28 | 2 | $output .= '<ul><li>' . $key . ' ' . self::fromArray($value) . '</code></li></ul>'; |
|
29 | } else { |
||
30 | 2 | $output .= '<li>' . $key . ' = <code>' . $value . '</code></li>'; |
|
31 | } |
||
32 | |||
33 | 2 | $output .= '</li>'; |
|
34 | } |
||
35 | |||
36 | 2 | $output .= '</ul>'; |
|
37 | |||
38 | 2 | return $output; |
|
39 | } |
||
40 | } |
||
41 |