Conditions | 5 |
Paths | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
16 | 2 | public function __debugInfo() // phpcs:ignore Zicht.NamingConventions.Functions.MethodNaming |
|
17 | { |
||
18 | 2 | $duplicateKeys = []; |
|
19 | 2 | $info = ['__length__' => 0]; |
|
20 | 2 | if ($this instanceof \Traversable) { |
|
21 | 2 | foreach ($this as $key => $value) { |
|
22 | 2 | $key = (string)$key; |
|
23 | 2 | while (array_key_exists($key, $info)) { |
|
24 | 1 | $duplicateKeys[$key] = array_key_exists($key, $duplicateKeys) ? $duplicateKeys[$key] + 1 : 1; |
|
25 | 1 | $key = sprintf('%s__#%s__', $key, $duplicateKeys[$key]); |
|
26 | } |
||
27 | 2 | $info[$key] = $value; |
|
28 | 2 | $info['__length__'] += 1; |
|
29 | } |
||
30 | } |
||
31 | 2 | return $info; |
|
32 | } |
||
33 | } |
||
34 |