26 lines
561 B
PHP
26 lines
561 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
enum ApprovalStatusEnum: string
|
|
{
|
|
case PENDING = 'pending';
|
|
case APPROVED = 'approved';
|
|
case REJECTED = 'rejected';
|
|
|
|
public function isDecided(): bool
|
|
{
|
|
return $this !== self::PENDING;
|
|
}
|
|
|
|
/**
|
|
* @return array<int, string>
|
|
*/
|
|
public static function decidedValues(): array
|
|
{
|
|
return array_values(array_map(
|
|
fn (self $status): string => $status->value,
|
|
array_filter(self::cases(), fn (self $status): bool => $status->isDecided()),
|
|
));
|
|
}
|
|
}
|