Conditions | 3 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
64 | 43 | public static function getClassFromName(string $name): int |
|
65 | { |
||
66 | 43 | $class = array_search(strtoupper($name), self::$classes, true); |
|
67 | |||
68 | 43 | if (false === $class || !is_int($class)) { |
|
69 | 1 | throw new \InvalidArgumentException(sprintf('Class: "%s" is not defined.', $name)); |
|
70 | } |
||
71 | |||
72 | 43 | return $class; |
|
73 | } |
||
75 |