update rm deadcode
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Enums\Product\ProductBillingCycle;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -31,17 +32,14 @@ class OrderHelper
|
||||
return $number;
|
||||
}
|
||||
|
||||
/** Number of months a billing_cycle value represents (used for pricing and expires_at math). */
|
||||
/**
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function cycleToMonths(?string $cycle): int
|
||||
{
|
||||
return match ($cycle) {
|
||||
'monthly' => 1,
|
||||
'quarterly' => 3,
|
||||
'semi_annually' => 6,
|
||||
'annually' => 12,
|
||||
'biennially' => 24,
|
||||
'triennially' => 36,
|
||||
default => 1,
|
||||
};
|
||||
$enum = ProductBillingCycle::tryFrom($cycle ?? '')
|
||||
?? throw new \InvalidArgumentException("Unknown billing cycle: " . ($cycle ?? 'null'));
|
||||
|
||||
return $enum === ProductBillingCycle::ONE_TIME ? 1 : $enum->months();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user