| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.128 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 1 | #[\Override] |
|
| 34 | public function get(string $name): object { |
||
| 35 | 1 | if (isset($this->instances[$name])) { |
|
| 36 | return $this->instances[$name]; |
||
| 37 | } |
||
| 38 | 1 | foreach ($this->getFqcnList() as $fqcn) { |
|
| 39 | 1 | $instance = \OCP\Server::get($fqcn); |
|
| 40 | 1 | if ($instance->getSettings()->id === $name) { |
|
| 41 | 1 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
|
| 42 | 1 | $this->instances[$name] = $instance; |
|
| 43 | 1 | return $instance; |
|
| 44 | } |
||
| 45 | } |
||
| 46 | throw new InvalidProviderException("Provider <$name> does not exist"); |
||
| 47 | } |
||
| 49 |