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