| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.25 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 22 | 27 | public function resolve(string $className): RuleHandlerInterface |
|
| 23 | { |
||
| 24 | 27 | if (!array_key_exists($className, $this->instances)) { |
|
| 25 | 27 | if (!in_array($className, $this->handlers, true)) { |
|
| 26 | throw new RuleHandlerNotFoundException($className); |
||
| 27 | } |
||
| 28 | 27 | if (!is_subclass_of($className, RuleHandlerInterface::class)) { |
|
| 29 | throw new RuleHandlerInterfaceNotImplementedException($className); |
||
| 30 | } |
||
| 31 | 27 | return $this->instances[$className] = new $className(); |
|
| 32 | } |
||
| 33 | |||
| 34 | 6 | return $this->instances[$className]; |
|
| 35 | } |
||
| 37 |