Code Duplication    Length = 11-11 lines in 2 locations

src/PackedBoxList.php 2 locations

@@ 33-43 (lines=11) @@
30
     *
31
     * @return int
32
     */
33
    public function compare($boxA, $boxB): int
34
    {
35
        $choice = $boxA->getItems()->count() - $boxB->getItems()->count();
36
        if ($choice === 0) {
37
            $choice = $boxB->getInnerVolume() - $boxA->getInnerVolume();
38
        }
39
        if ($choice === 0) {
40
            $choice = $boxA->getWeight() - $boxB->getWeight();
41
        }
42
        return $choice;
43
    }
44
45
    /**
46
     * Reversed version of compare
@@ 53-63 (lines=11) @@
50
     *
51
     * @return int
52
     */
53
    public function reverseCompare($boxA, $boxB): int
54
    {
55
        $choice = $boxB->getItems()->count() - $boxA->getItems()->count();
56
        if ($choice === 0) {
57
            $choice = $boxA->getInnerVolume() - $boxB->getInnerVolume();
58
        }
59
        if ($choice === 0) {
60
            $choice = $boxB->getWeight() - $boxA->getWeight();
61
        }
62
        return $choice;
63
    }
64
65
    /**
66
     * Calculate the average (mean) weight of the boxes