Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| NotificationStatus | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
| fromStored | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| badgeClass | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Enums; |
| 4 | |
| 5 | enum NotificationStatus: string |
| 6 | { |
| 7 | case Pending = 'Pending'; |
| 8 | case Sent = 'Sent'; |
| 9 | case Failed = 'Failed'; |
| 10 | |
| 11 | public static function fromStored(?string $value): self |
| 12 | { |
| 13 | return self::tryFrom((string) $value) ?? self::Pending; |
| 14 | } |
| 15 | |
| 16 | public function badgeClass(): string |
| 17 | { |
| 18 | return match ($this) { |
| 19 | self::Pending => 'bg-warning text-dark', |
| 20 | self::Sent => 'bg-success', |
| 21 | self::Failed => 'bg-danger', |
| 22 | }; |
| 23 | } |
| 24 | } |