Code Duplication    Length = 24-24 lines in 2 locations

src/helpers/ChargeSort.php 1 location

@@ 49-72 (lines=24) @@
46
        };
47
    }
48
49
    private static function byType(): \Closure
50
    {
51
        $order = [
52
            'rack',
53
            'rack_unit',
54
            'ip_num',
55
            'support_time',
56
            'backup_du',
57
            'server_traf_max',
58
            'server_traf95_max',
59
            'server_du',
60
            'server_ssd',
61
            'server_sata',
62
            'win_license',
63
        ];
64
65
        return function (Charge $charge) use ($order) {
66
            if (($key = array_search($charge->type, $order, true)) !== false) {
67
                return $key;
68
            }
69
70
            return INF;
71
        };
72
    }
73
74
    private static function keepDiscountsWithParents(): \Closure
75
    {

src/helpers/PriceSort.php 1 location

@@ 71-94 (lines=24) @@
68
        };
69
    }
70
71
    private static function byServerMainPrices(): \Closure
72
    {
73
        $order = [
74
            'rack',
75
            'rack_unit',
76
            'ip_num',
77
            'support_time',
78
            'backup_du',
79
            'server_traf_max',
80
            'server_traf95_max',
81
            'server_du',
82
            'server_ssd',
83
            'server_sata',
84
            'win_license',
85
        ];
86
87
        return function (Price $price) use ($order) {
88
            if (($key = array_search($price->getSubtype(), $order, true)) !== false) {
89
                return $key;
90
            }
91
92
            return INF;
93
        };
94
    }
95
96
    private static function byHardwareType(): \Closure
97
    {