Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
DefinitionType | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
fromName | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | |
3 | /** |
4 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
5 | */ |
6 | |
7 | declare(strict_types=1); |
8 | |
9 | namespace pvc\html\htmlBuilder\definitions\types; |
10 | |
11 | /** |
12 | * Class DefinitionType |
13 | */ |
14 | enum DefinitionType: string |
15 | { |
16 | case Attribute = 'Attribute'; |
17 | case AttributeValueTester = 'AttributeValueTester'; |
18 | case Element = 'Element'; |
19 | case Event = 'Event'; |
20 | case Other = 'Other'; |
21 | |
22 | public static function fromName(string $name): ?DefinitionType |
23 | { |
24 | foreach (self::cases() as $status) { |
25 | if ($name === $status->name) { |
26 | return $status; |
27 | } |
28 | } |
29 | return null; |
30 | } |
31 | } |