Conditions | 9 |
Paths | 26 |
Total Lines | 36 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function result() |
||
25 | { |
||
26 | # Default to at least 5 spaces of padding |
||
27 | $max = 5; |
||
28 | |||
29 | # Convert each element in the array to a string |
||
30 | foreach ($this->data as &$value) { |
||
31 | $type = strtolower(gettype($value)); |
||
32 | switch ($type) { |
||
33 | case 'boolean': |
||
34 | $value = $value ? '[true]' : '[false]'; |
||
35 | break; |
||
36 | case 'array': |
||
37 | case 'object': |
||
38 | case 'resource': |
||
39 | $value = '[' . $type . ']'; |
||
40 | break; |
||
41 | default: |
||
42 | $value = (string) $value; |
||
43 | break; |
||
44 | } |
||
45 | |||
46 | $len = strlen($value); |
||
47 | if ($len > $max) { |
||
48 | $max = $len; |
||
49 | } |
||
50 | } |
||
51 | unset($value); |
||
52 | |||
53 | $padding = new Padding($max); |
||
54 | $padding->char('-'); |
||
55 | |||
56 | foreach ($this->data as $key => $value) { |
||
57 | $padding->label($key)->result($value); |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 |