Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Arcanedev\LaravelNestedSet\Utilities; |
||
20 | 8 | public static function fixNodes(array &$dictionary) |
|
21 | { |
||
22 | 8 | $fixed = 0; |
|
23 | 8 | $cut = self::reorderNodes($dictionary, $fixed); |
|
24 | |||
25 | // Save nodes that have invalid parent as roots |
||
26 | 8 | while ( ! empty($dictionary)) { |
|
27 | 4 | $dictionary[null] = reset($dictionary); |
|
28 | 4 | unset($dictionary[key($dictionary)]); |
|
29 | |||
30 | 4 | $cut = self::reorderNodes($dictionary, $fixed, null, $cut); |
|
31 | 3 | } |
|
32 | |||
33 | 8 | return $fixed; |
|
34 | } |
||
35 | |||
75 |