| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 65 | 49 | public static function getClassId(string $className): int |
|
| 66 | { |
||
| 67 | 49 | if (!self::isValid($className)) { |
|
| 68 | 1 | throw new \InvalidArgumentException(sprintf('Class "%s" is not a valid DNS class.', $className)); |
|
| 69 | } |
||
| 70 | |||
| 71 | 48 | if (1 === preg_match('/^CLASS(\d+)$/', $className, $matches)) { |
|
| 72 | 2 | return (int) $matches[1]; |
|
| 73 | } |
||
| 74 | |||
| 75 | 47 | return self::CLASS_IDS[$className]; |
|
| 76 | } |
||
| 77 | |||
| 87 |