Debian Codegraph @

vendor/wikimedia/idle-dom/src/TextTrackKind.php

raw
1 <?php
2
3 // AUTOMATICALLY GENERATED. DO NOT EDIT.
4 // Use `composer build` to regenerate.
5
6 namespace Wikimedia\IDLeDOM;
7
8 /**
9 * TextTrackKind
10 *
11 * @see https://dom.spec.whatwg.org/#enumdef-texttrackkind
12 *
13 * @phan-forbid-undeclared-magic-properties
14 */
15 final class TextTrackKind {
16 /* Enumeration values */
17 public const subtitles = 'subtitles';
18 public const captions = 'captions';
19 public const descriptions = 'descriptions';
20 public const chapters = 'chapters';
21 public const metadata = 'metadata';
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 'subtitles':
40 case 'captions':
41 case 'descriptions':
42 case 'chapters':
43 case 'metadata':
44 return $value;
45 default:
46 throw new class() extends \Exception implements \Wikimedia\IDLeDOM\TypeError {
47 };
48 }
49 }
50 }