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 | public function enqueue_style() |
||
60 | |||
61 | /** |
||
62 | * Create a JSON object that will be printed in the admin section |
||
63 | * to be used by the TinyMCE plugin code. |
||
64 | */ |
||
65 | private function prepare_json_object() |
||
76 | |||
77 | /** |
||
78 | * Default shortcode arguments |
||
79 | */ |
||
80 | private function default_args() |
||
94 | |||
95 | /** |
||
96 | * Check if a shortcode with the given ID has already been registered |
||
97 | */ |
||
98 | private function shortcode_exists( $id ) |
||
102 | |||
103 | /** |
||
104 | * Validate that the provided arguments have the required arguments as |
||
105 | * specified in self::required_args() |
||
106 | */ |
||
107 | private function validate_args( $args ) |
||
117 | |||
118 | /** |
||
119 | * A list of required arguments |
||
120 | */ |
||
121 | private function required_args() |
||
125 | |||
126 | /** |
||
127 | * Private constructor to prevent instantiation |
||
128 | */ |
||
129 | private function __construct() |
||
134 | } |
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: