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