Simple problems require simple solutions
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
<?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,
|
|
};
|
|
}
|
|
}
|