Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
14 | public function compare(Item $itemA, Item $itemB): int |
||
15 | 100 | { |
|
16 | 100 | $volumeDecider = $itemB->getWidth() * $itemB->getLength() * $itemB->getDepth() <=> $itemA->getWidth() * $itemA->getLength() * $itemA->getDepth(); |
|
17 | 60 | if ($volumeDecider !== 0) { |
|
18 | return $volumeDecider; |
||
19 | 86 | } |
|
20 | 86 | $weightDecider = $itemB->getWeight() <=> $itemA->getWeight(); |
|
21 | 4 | if ($weightDecider !== 0) { |
|
22 | return $weightDecider; |
||
23 | } |
||
24 | 82 | ||
25 | return $itemA->getDescription() <=> $itemB->getDescription(); |
||
26 | } |
||
28 |