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