Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | 3 | public static function getLiteral(int|string $type): string |
|
40 | { |
||
41 | 3 | $refClass = new \ReflectionClass(self::class); |
|
42 | 3 | $names = array_flip($refClass->getConstants()); |
|
43 | |||
44 | 3 | if (isset($names[$type])) { |
|
45 | 2 | return $names[$type]; |
|
46 | } |
||
47 | |||
48 | assert(is_string($type)); |
||
49 | 1 | return $type; |
|
50 | } |
||
52 |