Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) |
||
32 | { |
||
33 | $class = $this->getClass($requestedName); |
||
34 | if (!$class) { |
||
35 | throw new Exception('Cannot create a PhpEnumType for a name not matching a backed enum: ' . $requestedName); |
||
36 | } |
||
37 | |||
38 | // Share the same instance between short name and FQCN |
||
39 | if (!array_key_exists($class, $this->cache)) { |
||
40 | $this->cache[$class] = new PhpEnumType($class); |
||
41 | } |
||
42 | |||
43 | return $this->cache[$class]; |
||
44 | } |
||
65 |