Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
15 | 4 | public function compare($a, $b): int { |
|
16 | 4 | $order = ['see', 'author', 'property-read', 'property-write', 'property', |
|
17 | 'method', 'deprecated', 'since', 'version', 'var', 'type', 'param', |
||
18 | 'throws', 'return']; |
||
19 | |||
20 | 4 | if ($a == $b) { |
|
21 | 2 | return 0; |
|
22 | } |
||
23 | |||
24 | 4 | if (!in_array($a, $order)) { |
|
25 | 1 | return -1; |
|
26 | } |
||
27 | |||
28 | 4 | if (!in_array($b, $order)) { |
|
29 | 1 | return 1; |
|
30 | } |
||
31 | |||
32 | 4 | $pos1 = array_search($a, $order); |
|
33 | 4 | $pos2 = array_search($b, $order); |
|
34 | |||
35 | 4 | return $pos1 < $pos2 ? -1 : 1; |
|
36 | } |
||
38 |