Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
77 | 35 | public static function getClassId(string $className): int |
|
78 | { |
||
79 | 35 | if (!self::isValid($className)) { |
|
80 | 1 | throw new \InvalidArgumentException(sprintf('Class "%s" is not a valid DNS class.', $className)); |
|
81 | } |
||
82 | |||
83 | 34 | if (1 === preg_match('/^CLASS(\d+)$/', $className, $matches)) { |
|
84 | 1 | return (int) $matches[1]; |
|
85 | } |
||
86 | |||
87 | 34 | return self::CLASS_IDS[$className]; |
|
88 | } |
||
104 |