| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.1825 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 2 | public function resolve(Container $container) |
|
| 36 | { |
||
| 37 | 2 | $className = $this->className; |
|
| 38 | 2 | if ($container->getRecipe($className) === $this) { |
|
| 39 | // calling produce will cause infinite loop if the key is same as $classname, break it here. |
||
| 40 | 1 | $instance = Factory::of($container)->instantiate($className, $this->extra); |
|
| 41 | if ($this->cached) { |
||
| 42 | $container->set($className, $instance); |
||
| 43 | } |
||
| 44 | return $instance; |
||
| 45 | } |
||
| 46 | |||
| 47 | 1 | return Factory::of($container)->produce( |
|
| 48 | 1 | /** @scrutinizer ignore-type */ $className, |
|
| 49 | 1 | $this->extra, |
|
| 50 | 1 | $this->cached |
|
| 51 | ); |
||
| 54 |