PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Badcow\DNS; class Classes { public const INTERNET = 'IN'; public const CSNET = 'CS'; public const CHAOS = 'CH'; public const HESIOD = 'HS'; /** * @var array */ public static $classes = [ self::CHAOS => 'CHAOS', self::CSNET => 'CSNET', self::HESIOD => 'Hesiod', self::INTERNET => 'Internet', ]; public const CLASS_IDS = [ self::CHAOS => 3, self::CSNET => 2, self::HESIOD => 4, self::INTERNET => 1, ]; /** * @const string[] */ public const IDS_CLASSES = [ 1 => 'IN', 2 => 'CS', 3 => 'CH', 4 => 'HS', ]; /** * Determine if a class is valid. */ public static function isValid(string $class): bool { if (array_key_exists($class, self::$classes)) { return true; } return 1 === preg_match('/^CLASS\d+$/', $class); } /** * @throws \InvalidArgumentException */ public static function getClassId(string $className): int { if (!self::isValid($className)) { throw new \InvalidArgumentException(sprintf('Class "%s" is not a valid DNS class.', $className)); } if (1 === preg_match('/^CLASS(\d+)$/', $className, $matches)) { return (int) $matches[1]; } return self::CLASS_IDS[$className]; } public static function getClassName(int $classId): string { if (array_key_exists($classId, self::IDS_CLASSES)) { return self::IDS_CLASSES[$classId]; } return 'CLASS'.$classId; } }