| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 17 | 
| Code Lines | 8 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 9 | 
| CRAP Score | 4 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 16 | 123 | public function resolve(string $className): RuleHandlerInterface | |
| 17 |     { | ||
| 18 | 123 |         if (!class_exists($className)) { | |
| 19 | 1 | throw new RuleHandlerNotFoundException($className); | |
| 20 | } | ||
| 21 | |||
| 22 | 122 |         if (array_key_exists($className, $this->instances)) { | |
| 23 | 36 | return $this->instances[$className]; | |
| 24 | } | ||
| 25 | |||
| 26 | 110 | $classInstance = new $className(); | |
| 27 | |||
| 28 | 110 |         if (!$classInstance instanceof RuleHandlerInterface) { | |
| 29 | 1 | throw new RuleHandlerInterfaceNotImplementedException($className); | |
| 30 | } | ||
| 31 | |||
| 32 | 109 | return $this->instances[$className] = $classInstance; | |
| 33 | } | ||
| 35 |