Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public static function getInstance(string $instanceKey = ''): self |
||
26 | { |
||
27 | $instanceKey = empty($instanceKey) ? __CLASS__ : $instanceKey; |
||
28 | |||
29 | // instance exist |
||
30 | if (empty(self::$instance[$instanceKey])) { |
||
31 | $reflection = new \ReflectionClass(__CLASS__); |
||
32 | $arg = func_get_args(); |
||
33 | array_shift($arg); |
||
34 | self::$instance[$instanceKey] = $reflection->newInstanceArgs($arg); |
||
35 | } |
||
36 | |||
37 | return self::$instance[$instanceKey]; |
||
38 | } |
||
63 | } |