| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 5 | private function saturate($default, $class) |
|
|
|
|||
| 36 | { |
||
| 37 | 5 | if (!empty($default)) { |
|
| 38 | 2 | return $default; |
|
| 39 | } |
||
| 40 | |||
| 41 | 3 | $container = $this->iocContainer(); |
|
| 42 | |||
| 43 | 3 | if (empty($container)) { |
|
| 44 | 1 | throw new ScopeException("Unable to saturate '{$class}': no container available"); |
|
| 45 | } |
||
| 46 | |||
| 47 | //Only when global container is set |
||
| 48 | try { |
||
| 49 | 2 | return $container->get($class); |
|
| 50 | 1 | } catch (ContainerException $e) { |
|
| 51 | 1 | throw new ScopeException("Unable to saturate '{$class}': {$e->getMessage()}", 0, $e); |
|
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 62 |