Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
16 / 16 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| VoidElements | |
100.00% |
16 / 16 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getElementNames | |
100.00% |
15 / 15 |
|
100.00% |
1 / 1 |
1 | |||
| isVoid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace pvc\html\element; |
| 4 | |
| 5 | class VoidElements |
| 6 | { |
| 7 | /** |
| 8 | * @return array<string> |
| 9 | */ |
| 10 | public static function getElementNames(): array |
| 11 | { |
| 12 | return [ |
| 13 | 'area', |
| 14 | 'base', |
| 15 | 'br', |
| 16 | 'col', |
| 17 | 'embed', |
| 18 | 'hr', |
| 19 | 'img', |
| 20 | 'input', |
| 21 | 'link', |
| 22 | 'meta', |
| 23 | 'source', |
| 24 | 'track', |
| 25 | 'wbr' |
| 26 | ]; |
| 27 | } |
| 28 | |
| 29 | public static function isVoid(string $elementName): bool |
| 30 | { |
| 31 | return (in_array($elementName, self::getElementNames(), true)); |
| 32 | } |
| 33 | |
| 34 | } |