Conditions | 2 |
Paths | 2 |
Total Lines | 7 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function __construct(string $index = 'main') |
||
17 | { |
||
18 | $className = self::getClassName(); |
||
19 | if (isset(self::$instances[$className][$index])) { |
||
20 | die("Please use '$className:getInstance()' instead of 'new' to instantiate a Singleton."); |
||
|
|||
21 | } |
||
22 | self::$instances[$className][$index] = $this; |
||
23 | } |
||
56 | } |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.