Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
DOMParserSupportedType | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
72 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
cast | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
56 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM; |
7 | |
8 | /** |
9 | * DOMParserSupportedType |
10 | * |
11 | * @see https://dom.spec.whatwg.org/#enumdef-domparsersupportedtype |
12 | * |
13 | * @phan-forbid-undeclared-magic-properties |
14 | */ |
15 | final class DOMParserSupportedType { |
16 | /* Enumeration values */ |
17 | public const text_html = 'text/html'; |
18 | public const text_xml = 'text/xml'; |
19 | public const application_xml = 'application/xml'; |
20 | public const application_xhtml_xml = 'application/xhtml+xml'; |
21 | public const image_svg_xml = 'image/svg+xml'; |
22 | |
23 | private function __construct() { |
24 | /* Enumerations can't be instantiated */ |
25 | } |
26 | |
27 | // @phan-file-suppress PhanTypeInvalidThrowsIsInterface |
28 | |
29 | /** |
30 | * Throw a TypeError if the provided string is not a |
31 | * valid member of this enumeration. |
32 | * |
33 | * @param string $value The string to test |
34 | * @return string The provided string, if it is valid |
35 | * @throws \Wikimedia\IDLeDOM\TypeError if it is not valid |
36 | */ |
37 | public static function cast( string $value ): string { |
38 | switch ( $value ) { |
39 | case 'text/html': |
40 | case 'text/xml': |
41 | case 'application/xml': |
42 | case 'application/xhtml+xml': |
43 | case 'image/svg+xml': |
44 | return $value; |
45 | default: |
46 | throw new class() extends \Exception implements \Wikimedia\IDLeDOM\TypeError { |
47 | }; |
48 | } |
49 | } |
50 | } |