Conditions | 7 |
Paths | 25 |
Total Lines | 29 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
9 | 5 | public function create(array $input, array $output): string |
|
10 | { |
||
11 | 5 | $received = []; |
|
12 | |||
13 | 5 | foreach ($input as $inputKey => $inputValue) { |
|
14 | 5 | if ('array' === gettype($inputValue)) { |
|
15 | 2 | $received[$inputKey] = '['; |
|
16 | 2 | $received[$inputKey] .= implode(', ', $inputValue); |
|
17 | 2 | $received[$inputKey] .= '] -> '; |
|
18 | } |
||
19 | // TODO: make sure this works for objects which do not have a __toString method |
||
20 | 5 | if ('object' === gettype($inputValue)) { |
|
21 | 3 | $received[$inputKey] = '[' . $inputValue . '] -> '; |
|
|
|||
22 | } |
||
23 | } |
||
24 | |||
25 | 5 | foreach ($output as $outputKey => $outputValue) { |
|
26 | 5 | if ('array' === gettype($outputValue)) { |
|
27 | 1 | $received[$outputKey] = $received[$outputKey] . '['; |
|
28 | 1 | $received[$outputKey] .= implode(', ', $outputValue); |
|
29 | 1 | $received[$outputKey] .= ']'; |
|
30 | } |
||
31 | |||
32 | 5 | if ('object' === gettype($outputValue)) { |
|
33 | 4 | $received[$outputKey] = $received[$outputKey] . '[' . $outputValue . ']'; |
|
34 | } |
||
35 | } |
||
36 | |||
37 | 5 | return implode("\n", $received); |
|
38 | } |
||
40 |