Conditions | 5 |
Paths | 9 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
49 | private function buildQuery(array $data, string $path = ''): string |
||
50 | { |
||
51 | $query = ''; |
||
52 | foreach ($data as $key => $value) { |
||
53 | $subPathKey = !is_int($key) ? $key : $this->numericPrefix.$key; |
||
54 | $subPath = '' !== $path ? $path.'['.$subPathKey.']' : $subPathKey; |
||
55 | |||
56 | if (is_array($value)) { |
||
57 | $query .= $this->buildQuery($value, $subPath); |
||
58 | } else { |
||
59 | $query .= $subPath.'='.urlencode((string) $value); |
||
60 | } |
||
61 | |||
62 | $query .= $this->argSeperator; |
||
63 | } |
||
64 | |||
65 | $query = substr($query, 0, -strlen($this->argSeperator)); |
||
66 | |||
67 | return $query; |
||
68 | } |
||
69 | } |
||
70 |