| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 3 | public function getInjector(AbstractAppMeta $appMeta, $contexts) |
|
| 21 | { |
||
| 22 | try { |
||
| 23 | 3 | $injector = (new ScriptInjector($appMeta->tmpDir))->getInstance(InjectorInterface::class); |
|
| 24 | 3 | } catch (NotCompiled $e) { |
|
| 25 | 3 | $module = (new Module)($appMeta, $contexts); |
|
| 26 | 2 | $module->override(new MiddlewareModule()); |
|
| 27 | 2 | $compiler = new DiCompiler(new StreamModule($module), $appMeta->tmpDir); |
|
| 28 | 2 | $compiler->compile(); |
|
| 29 | 2 | $injector = (new ScriptInjector($appMeta->tmpDir))->getInstance(InjectorInterface::class); |
|
| 30 | } |
||
| 31 | |||
| 32 | 2 | return $injector; |
|
| 33 | } |
||
| 34 | } |
||
| 35 |