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