Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
14 | 34 | public function resolve(string $className): RuleHandlerInterface |
|
15 | { |
||
16 | 34 | if (!array_key_exists($className, $this->instances)) { |
|
17 | 34 | if (!is_subclass_of($className, RuleHandlerInterface::class)) { |
|
18 | 1 | throw new RuleHandlerInterfaceNotImplementedException($className); |
|
19 | } |
||
20 | 33 | return $this->instances[$className] = new $className(); |
|
21 | } |
||
22 | |||
23 | 7 | return $this->instances[$className]; |
|
24 | } |
||
26 |