| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function sort(array $nodes, $currentNodeId) |
||
| 15 | { |
||
| 16 | if (count($nodes) === 1) { |
||
| 17 | return $nodes; |
||
| 18 | } |
||
| 19 | |||
| 20 | $nodeIds = array_keys($nodes); |
||
| 21 | shuffle($nodeIds); |
||
| 22 | |||
| 23 | $shuffledNodes = []; |
||
| 24 | foreach ($nodeIds as $nodeId) { |
||
| 25 | $shuffledNodes[$nodeId] = $nodes[$nodeId]; |
||
| 26 | } |
||
| 27 | |||
| 28 | return $shuffledNodes; |
||
| 29 | } |
||
| 30 | } |
||
| 31 |