Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
12 | public function sort(array $nodes, $currentNodeId) |
||
13 | { |
||
14 | if (current($nodes) === $nodes[$currentNodeId]) { |
||
15 | return $nodes; |
||
16 | } |
||
17 | |||
18 | // Move the current node to the first place |
||
19 | $currentNode = $nodes[$currentNodeId]; |
||
20 | unset($nodes[$currentNodeId]); |
||
21 | array_unshift($nodes, $currentNode); |
||
22 | |||
23 | return $nodes; |
||
24 | } |
||
25 | } |
||
26 |