| Conditions | 6 |
| Paths | 9 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 12 | private function flatten(array $params, $result = '', $previousName = null): string |
|
| 36 | { |
||
| 37 | 12 | foreach ($params as $key => $value) { |
|
| 38 | 12 | if ($previousName) { |
|
| 39 | 1 | $name = $previousName . '[' . $key . ']'; |
|
| 40 | } else { |
||
| 41 | 12 | $name = $key; |
|
| 42 | } |
||
| 43 | |||
| 44 | 12 | if (is_array($value)) { |
|
| 45 | 1 | $result = $this->flatten($value, $result, $name); |
|
| 46 | } else { |
||
| 47 | 12 | if ($result) { |
|
| 48 | 4 | $result .= $this->escapeParams ? '&' : '&'; |
|
| 49 | } |
||
| 50 | |||
| 51 | 12 | $result .= $name . '=' . urlencode($value); |
|
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | 12 | return $result; |
|
| 56 | } |
||
| 58 |