Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
56 | 4 | public function get(string $className) |
|
57 | { |
||
58 | 4 | if (isset($this->instanceCache[$className])) { |
|
59 | /** @var T $instance */ |
||
60 | 2 | $instance = $this->instanceCache[$className]; |
|
61 | |||
62 | 2 | return $instance; |
|
63 | } |
||
64 | |||
65 | /** @var T|null $locatedInstance */ |
||
66 | 3 | $locatedInstance = AnonymousGlobal::getByClassName($className) |
|
67 | 3 | ?? GacelaContainer::create($className); |
|
68 | |||
69 | /** @psalm-suppress MixedAssignment */ |
||
70 | 3 | $this->instanceCache[$className] = $locatedInstance; |
|
71 | |||
72 | 3 | return $locatedInstance; |
|
73 | } |
||
75 |