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