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