| 1 | <?php |
||
| 16 | class Classes |
||
| 17 | { |
||
| 18 | const INTERNET = 'IN'; |
||
| 19 | const CSNET = 'CS'; |
||
| 20 | const CHAOS = 'CH'; |
||
| 21 | const HESIOD = 'HS'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | public static $classes = [ |
||
| 27 | self::CHAOS => 'CHAOS', |
||
| 28 | self::CSNET => 'CSNET', |
||
| 29 | self::HESIOD => 'Hesiod', |
||
| 30 | self::INTERNET => 'Internet', |
||
| 31 | ]; |
||
| 32 | |||
| 33 | const CLASS_IDS = [ |
||
| 34 | self::CHAOS => 3, |
||
| 35 | self::CSNET => 2, |
||
| 36 | self::HESIOD => 4, |
||
| 37 | self::INTERNET => 1, |
||
| 38 | ]; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @const string[] |
||
| 42 | */ |
||
| 43 | const IDS_CLASSES = [ |
||
| 44 | 1 => 'IN', |
||
| 45 | 2 => 'CS', |
||
| 46 | 3 => 'CH', |
||
| 47 | 4 => 'HS', |
||
| 48 | ]; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Determine if a class is valid. |
||
| 52 | */ |
||
| 53 | 53 | public static function isValid(string $class): bool |
|
| 61 | |||
| 62 | /** |
||
| 63 | * @throws \InvalidArgumentException |
||
| 64 | */ |
||
| 65 | 49 | public static function getClassId(string $className): int |
|
| 77 | |||
| 78 | 40 | public static function getClassName(int $classId): string |
|
| 86 | } |
||
| 87 |