PluginProbe
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.6.1
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.6.1
3.6.1 3.6.0 3.5.3 3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 165 releases
everest-forms / traits / Singleton.php
Singleton.php
53 lines 747 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Singleton class trait.
4 *
5 * @package EverestForms\Traits
6 */
7
8 namespace EverestForms\Traits;
9
10 /**
11 * Singleton trait.
12 */
13 trait Singleton {
14
15 /**
16 * Holds single instance of the class.
17 *
18 * @var null|static
19 */
20 private static $instance = null;
21
22 /**
23 * Get instance of the class.
24 *
25 * @return static
26 */
27 final public static function init() {
28 if ( is_null( static::$instance ) ) {
29 static::$instance = new static();
30 }
31 return static::$instance;
32 }
33
34 /**
35 * Constructor.
36 */
37 protected function __construct() {}
38
39 /**
40 * Disable un-serializing of the class.
41 *
42 * @return void
43 */
44 public function __wakeup() {}
45
46 /**
47 * Disable cloning of the class.
48 *
49 * @return void
50 */
51 public function __clone() {}
52 }
53