Conditions | 7 |
Paths | 7 |
Total Lines | 27 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
34 | protected function convertValuesToStrings(array $data) |
||
35 | { |
||
36 | $strings = []; |
||
37 | |||
38 | # Convert each element in the array to a string |
||
39 | foreach ($data as $key => $value) { |
||
40 | $type = strtolower(gettype($value)); |
||
41 | switch ($type) { |
||
42 | case 'boolean': |
||
43 | $value = $value ? '[true]' : '[false]'; |
||
44 | break; |
||
45 | case 'array': |
||
46 | case 'object': |
||
47 | case 'resource': |
||
48 | $value = '[' . $type . ']'; |
||
49 | break; |
||
50 | default: |
||
51 | $value = (string) $value; |
||
52 | break; |
||
53 | } |
||
54 | |||
55 | $key = (string) $key; |
||
56 | $strings[$key] = $value; |
||
57 | } |
||
58 | |||
59 | return $strings; |
||
60 | } |
||
61 | |||
85 |