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