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