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