Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
InsuranceType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
fromName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Alfa\Interview\Context\Enum; |
6 | |
7 | use Alfa\Interview\Context\Trait\CanTryFromName; |
8 | |
9 | enum InsuranceType: int |
10 | { |
11 | use CanTryFromName; |
12 | |
13 | case Flat = 100; |
14 | case Casco = 200; |
15 | case Unknown = 0; |
16 | |
17 | public static function fromName(string $name): self |
18 | { |
19 | return self::tryFromName($name) ?? self::Unknown; |
20 | } |
21 | } |