Code Duplication    Length = 12-12 lines in 2 locations

src/helpers/ChargeSort.php 1 location

@@ 23-34 (lines=12) @@
20
            ->asc(self::keepDiscountsWithParents());
21
    }
22
23
    private static function byType(): \Closure
24
    {
25
        $order = ['rack_unit', 'ip_num', 'support_time', 'backup_du', 'server_traf_max', 'server_traf95_max'];
26
27
        return function (Charge $charge) use ($order) {
28
            if (($key = array_search($charge->type, $order, true)) !== false) {
29
                return $key;
30
            }
31
32
            return INF;
33
        };
34
    }
35
36
    private static function keepDiscountsWithParents(): \Closure
37
    {

src/helpers/PriceSort.php 1 location

@@ 59-70 (lines=12) @@
56
        };
57
    }
58
59
    private static function byServerMainPrices(): \Closure
60
    {
61
        $order = ['rack_unit', 'ip_num', 'support_time', 'backup_du', 'server_traf_max', 'server_traf95_max'];
62
63
        return function (Price $price) use ($order) {
64
            if (($key = array_search($price->getSubtype(), $order)) !== false) {
65
                return $key;
66
            }
67
68
            return INF;
69
        };
70
    }
71
72
    private static function byHardwareType(): \Closure
73
    {