| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | #[\Override] |
||
| 39 | public function get(string $name): IProvider { |
||
| 40 | if (isset($this->instances[$name])) { |
||
| 41 | /** @var IProvider */ |
||
| 42 | return $this->instances[$name]; |
||
| 43 | } |
||
| 44 | foreach ($this->getFqcnList() as $fqcn) { |
||
| 45 | if ($fqcn::getProviderId() === $name) { |
||
| 46 | $instance = \OCP\Server::get($fqcn); |
||
| 47 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
||
| 48 | $this->instances[$name] = $instance; |
||
| 49 | return $instance; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | throw new InvalidProviderException("Provider <$name> does not exist"); |
||
| 53 | } |
||
| 55 |