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