1 | <?php |
||
18 | abstract class Singleton |
||
19 | { |
||
20 | /** |
||
21 | * array of static instances |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | |||
26 | protected static $_instanceArray = []; |
||
27 | |||
28 | /** |
||
29 | * constructor of the class |
||
30 | * |
||
31 | * @since 2.2.0 |
||
32 | */ |
||
33 | |||
34 | private function __construct() |
||
37 | |||
38 | /** |
||
39 | * clone of the class |
||
40 | * |
||
41 | * @since 5.0.0 |
||
42 | */ |
||
43 | |||
44 | private function __clone() |
||
47 | |||
48 | /** |
||
49 | * get the instance |
||
50 | * |
||
51 | * @since 5.0.0 |
||
52 | * |
||
53 | * @return static |
||
54 | */ |
||
55 | |||
56 | public static function getInstance() |
||
68 | |||
69 | /** |
||
70 | * clear the instance |
||
71 | * |
||
72 | * @since 3.0.0 |
||
73 | */ |
||
74 | |||
75 | public static function clearInstance() : void |
||
80 | } |
||
81 |