Conditions | 4 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
33 | 1 | private function buildQuery(array $data, string $path = ''): string |
|
34 | { |
||
35 | |||
36 | 1 | $query = ''; |
|
37 | 1 | foreach ($data as $key => $value) { |
|
38 | 1 | $subPath = '' !== $path ? $path.'['.$key.']' : $key; |
|
39 | 1 | if (is_array($value)) { |
|
40 | 1 | $query .= $this->buildQuery($value, $subPath); |
|
41 | } else { |
||
42 | 1 | $query .= $subPath.'='.urlencode($this->convertValueToString($value)); |
|
43 | } |
||
44 | 1 | $query .= '&'; |
|
45 | } |
||
46 | 1 | $query = substr($query, 0, -strlen('&')); |
|
47 | |||
48 | 1 | return $query; |
|
49 | } |
||
50 | |||
68 |