1 | <?php |
||
5 | class Manager |
||
6 | { |
||
7 | /** |
||
8 | * @var Singleton The reference to *Singleton* instance of this class |
||
9 | */ |
||
10 | private static $instance; |
||
11 | |||
12 | private $shortcodes = array(); |
||
13 | |||
14 | /** |
||
15 | * Returns the *Singleton* instance of this class. |
||
16 | * |
||
17 | * @return Singleton The *Singleton* instance. |
||
18 | */ |
||
19 | public static function get_instance() |
||
27 | |||
28 | public function register_shortcode( $args ) |
||
37 | |||
38 | public function print_json_object($plugin_array) |
||
43 | |||
44 | public function enqueue_script($plugins_array) |
||
55 | |||
56 | /** |
||
57 | * Create a JSON object that will be printed in the admin section |
||
58 | * to be used by the TinyMCE plugin code. |
||
59 | */ |
||
60 | private function prepare_json_object() |
||
71 | |||
72 | /** |
||
73 | * Default shortcode arguments |
||
74 | */ |
||
75 | private function default_args() |
||
89 | |||
90 | /** |
||
91 | * Check if a shortcode with the given ID has already been registered |
||
92 | */ |
||
93 | private function shortcode_exists( $id ) |
||
97 | |||
98 | /** |
||
99 | * Validate that the provided arguments have the required arguments as |
||
100 | * specified in self::required_args() |
||
101 | */ |
||
102 | private function validate_args( $args ) |
||
112 | |||
113 | /** |
||
114 | * A list of required arguments |
||
115 | */ |
||
116 | private function required_args() |
||
120 | |||
121 | /** |
||
122 | * Private constructor to prevent instantiation |
||
123 | */ |
||
124 | private function __construct() |
||
128 | } |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: