-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBaseClass.php
78 lines (70 loc) · 1.41 KB
/
BaseClass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* The base class of the plugin.
*
* @link https://wpsocio.com
* @since 1.0.0
*
* @package WPTelegram\Widget
* @subpackage WPTelegram\Widget\includes
*/
namespace WPTelegram\Widget\includes;
/**
* The base class of the plugin.
*
* The base class of the plugin.
*
* @package WPTelegram\Widget
* @subpackage WPTelegram\Widget\includes
* @author WP Socio
*/
abstract class BaseClass {
/**
* Instances of the class.
*
* @since 2.1.16
* @access protected
* @var self $instances The instances.
*/
protected static $instances = [];
/**
* The plugin class instance.
*
* @since 1.0.0
* @access protected
* @var Main $plugin The plugin class instance.
*/
protected $plugin;
/**
* Base class Instance.
*
* Ensures only one instance of the class is loaded or can be loaded.
*
* @since 2.1.16
*
* @return static
*/
public static function instance() {
if ( ! isset( self::$instances[ static::class ] ) ) {
self::$instances[ static::class ] = new static();
}
return self::$instances[ static::class ];
}
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
*/
protected function __construct() {
$this->plugin = Main::instance();
}
/**
* Get the instance of the plugin.
*
* @since 2.0.2
* @return Main The plugin class instance.
*/
protected function plugin() {
return $this->plugin;
}
}