PluginProbe
Advanced Access Manager – Access Governance for WordPress / 6.9.0
Advanced Access Manager – Access Governance for WordPress v6.9.0
7.1.4 7.1.2 7.1.3 6.8.4 6.8.5 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13 6.9.14 6.9.15 6.9.16 6.9.17 6.9.18 6.9.19 6.9.2 6.9.20 6.9.21 6.9.22 6.9.23 6.9.24 6.9.25 6.9.26 All 210 releases
advanced-access-manager / application / Core / Contract / SingletonTrait.php
SingletonTrait.php
73 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * ======================================================================
5 * LICENSE: This file is subject to the terms and conditions defined in *
6 * file 'license.txt', which is part of this source code package. *
7 * ======================================================================
8 *
9 * @version 6.0.0
10 */
11
12 /**
13 * Reusable elements for singletons
14 *
15 * @package AAM
16 * @version 6.0.0
17 */
18 trait AAM_Core_Contract_SingletonTrait
19 {
20
21 /**
22 * Single instance of itself
23 *
24 * @var object
25 *
26 * @access private
27 */
28 private static $_instance = null;
29
30 /**
31 * Constructor
32 *
33 * @access protected
34 * @version 6.0.0
35 */
36 protected function __construct()
37 { }
38
39 /**
40 * Bootstrap the object
41 *
42 * @return self
43 *
44 * @access public
45 * @version 6.0.0
46 */
47 public static function bootstrap()
48 {
49 if (is_null(self::$_instance)) {
50 self::$_instance = new self;
51 }
52
53 return self::$_instance;
54 }
55
56 /**
57 * Get single instance of itself
58 *
59 * @return self
60 *
61 * @access public
62 * @version 6.0.0
63 */
64 public static function getInstance()
65 {
66 if (is_null(self::$_instance)) {
67 self::$_instance = self::bootstrap();
68 }
69
70 return self::$_instance;
71 }
72
73 }