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