|
|
- <?php
-
- namespace App\Enums;
-
- enum DurationModifier: string
- {
- case None = 'none';
- case Second = 'second';
- case Minute = 'minute';
- case Hour = 'hour';
- case Year = 'year';
-
- public function durationModiferInDays(): int | float
- {
- return match ($this) {
- self::None => 1,
- self::Second => 86400,
- self::Minute => 1440,
- self::Hour => 24,
- self::Year => 0.00273973,
- };
- }
- }
|