| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function resolve(ContainerInterface $container) |
||
| 34 | { |
||
| 35 | try { |
||
| 36 | $result = $container->get($this->class); |
||
| 37 | } catch (\Throwable $t) { |
||
| 38 | if ($this->optional) { |
||
| 39 | return null; |
||
| 40 | } |
||
| 41 | throw $t; |
||
| 42 | } |
||
| 43 | |||
| 44 | if (!$result instanceof $this->class) { |
||
| 45 | throw new InvalidConfigException('Container returned incorrect type for service ' . $this->class); |
||
| 46 | } |
||
| 47 | return $result; |
||
| 48 | } |
||
| 50 |