1 | <?php |
||
12 | Trait Singleton |
||
13 | { |
||
14 | /** |
||
15 | * Singleton instance of this class. |
||
16 | * |
||
17 | * @since 1.0.0 |
||
18 | * @var \WPDFI\Traits\Singleton |
||
19 | */ |
||
20 | protected static $instance = null; |
||
21 | |||
22 | /** |
||
23 | * Constructor |
||
24 | * |
||
25 | * @since 1.0.0 |
||
26 | * @return void |
||
|
|||
27 | */ |
||
28 | protected function __construct() { |
||
31 | |||
32 | /** |
||
33 | * Creates or returns an instance of this class. |
||
34 | * |
||
35 | * @since 1.0.0 |
||
36 | * @return WPDFI\Traits\Singleton A single instance of this class. |
||
37 | */ |
||
38 | public static function instance() { |
||
44 | |||
45 | /** |
||
46 | * All Initialize actions come here |
||
47 | * |
||
48 | * @since 1.0.0 |
||
49 | * @return void |
||
50 | */ |
||
51 | abstract public function initializes(); |
||
52 | } |
||
53 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.