Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/fluentform/app/Services/Spout/Common/Singleton.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 +
3 + namespace Box\Spout\Common;
4 +
5 + /**
6 + * Class Singleton
7 + * Defines a class as a singleton.
8 + *
9 + * @package Box\Spout\Common
10 + */
11 + trait Singleton
12 + {
13 + protected static $instance;
14 +
15 + /**
16 + * @return static
17 + */
18 + final public static function getInstance()
19 + {
20 + return isset(static::$instance)
21 + ? static::$instance
22 + : static::$instance = new static;
23 + }
24 +
25 + /**
26 + * Singleton constructor.
27 + */
28 + final private function __construct()
29 + {
30 + $this->init();
31 + }
32 +
33 + /**
34 + * Initializes the singleton
35 + * @return void
36 + */
37 + protected function init() {}
38 +
39 + final public function __wakeup() {}
40 + final public function __clone() {}
41 + }
42 +