| Conditions | 6 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6.3541 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 34 | 1 | #[\Override] |
|
| 35 | public function get(string $name): object { |
||
| 36 | 1 | if (isset($this->instancesByFqcn[$name])) { |
|
| 37 | return $this->instancesByFqcn[$name]; |
||
| 38 | } |
||
| 39 | 1 | if (isset($this->instances[$name])) { |
|
| 40 | return $this->instances[$name]; |
||
| 41 | } |
||
| 42 | 1 | foreach ($this->getFqcnList() as $fqcn) { |
|
| 43 | 1 | $instance = \OCP\Server::get($fqcn); |
|
| 44 | 1 | $settings = $instance->getSettings(); |
|
| 45 | 1 | if ($fqcn === $name || $settings->id === $name) { |
|
| 46 | 1 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
|
| 47 | 1 | $this->instances[$name] = $instance; |
|
| 48 | 1 | $this->instancesByFqcn[$fqcn] = $instance; |
|
| 49 | 1 | return $instance; |
|
| 50 | } |
||
| 51 | } |
||
| 52 | throw new InvalidProviderException("Provider <$name> does not exist"); |
||
| 53 | } |
||
| 55 |