Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
47 | public function get(string $className): SingletonInterface |
||
48 | { |
||
49 | if (isset($this->objects[$className]) && is_object($this->objects[$className])) { |
||
50 | return $this->objects[$className]; |
||
51 | } |
||
52 | |||
53 | if (!ClassUtils::implements($className, SingletonInterface::class)) { |
||
54 | throw new InvalidClassException(); |
||
55 | } |
||
56 | |||
57 | return ($this->objects[$className] = new $className($this->context)); |
||
58 | } |
||
60 |