| Conditions | 2 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function register(): void |
||
| 32 | { |
||
| 33 | 1 | $this->getContainer()->share(DriverManager::class, function () { |
|
| 34 | 1 | $manager = new DriverManager($this->getContainer()); |
|
| 35 | |||
| 36 | // Here we will discover all drivers installed |
||
| 37 | // And add all found drivers to the manager |
||
| 38 | 1 | $assets = $this->discovery->getAssetType(Driver::class); |
|
| 39 | |||
| 40 | 1 | foreach ($assets->getAssets() as $asset) { |
|
| 41 | 1 | $manager->add( |
|
| 42 | 1 | $this->getContainer()->get($asset->getValue()), |
|
| 43 | 1 | $asset->getMetadata()['name'], |
|
| 44 | 1 | Arr::get($asset->getMetadata(), 'parameters', []) |
|
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 48 | 1 | return $manager; |
|
| 49 | 1 | }); |
|
| 50 | 1 | } |
|
| 51 | } |
||
| 52 |