| Conditions | 3 |
| Paths | 2 |
| Total Lines | 31 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | 1 | public function getContainer(): ContainerInterface |
|
| 46 | { |
||
| 47 | 1 | $id = $this->id; |
|
| 48 | 1 | $class = $this->class; |
|
| 49 | 1 | $file = sys_get_temp_dir().'/doyo/coverage/'.$id.'.php'; |
|
| 50 | //$config = ['config' => $this->config]; |
||
| 51 | 1 | $config = $this->config; |
|
| 52 | |||
| 53 | 1 | $cachedContainer = new ConfigCache($file, $this->debug); |
|
| 54 | 1 | if(!$cachedContainer->isFresh() || $this->debug){ |
|
| 55 | //$this->dumpConfig(); |
||
| 56 | 1 | $builder = new ContainerBuilder(); |
|
| 57 | |||
| 58 | 1 | $builder->registerExtension(new CodeCoverageExtension()); |
|
| 59 | 1 | $builder->loadFromExtension('coverage',$config); |
|
| 60 | |||
| 61 | 1 | $builder->addCompilerPass(new CoveragePass()); |
|
| 62 | 1 | $builder->addCompilerPass(new ReportPass()); |
|
| 63 | 1 | $builder->compile(); |
|
| 64 | |||
| 65 | 1 | $dumper = new PhpDumper($builder); |
|
| 66 | 1 | $cachedContainer->write( |
|
| 67 | 1 | $dumper->dump([ |
|
| 68 | 1 | 'class' => $class |
|
| 69 | ]), |
||
| 70 | 1 | $builder->getResources() |
|
| 71 | ); |
||
| 72 | } |
||
| 73 | |||
| 74 | 1 | require_once $file; |
|
| 75 | 1 | return new $class(); |
|
| 76 | } |
||
| 78 |