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 $pages = array(); |
||
13 | |||
14 | private $subpages = array(); |
||
15 | |||
16 | /** |
||
17 | * Returns the *Singleton* instance of this class. |
||
18 | * |
||
19 | * @return Singleton The *Singleton* instance. |
||
20 | */ |
||
21 | public static function get_instance() |
||
29 | |||
30 | public function add_page($args) |
||
39 | |||
40 | public function add_subpage($args) |
||
44 | |||
45 | public function register_settings() |
||
51 | |||
52 | /** |
||
53 | * Register styles & scripts to be enqueued by settings subpages |
||
54 | */ |
||
55 | public function register_scripts() |
||
60 | |||
61 | public function save_settings() |
||
66 | |||
67 | public function reset_settings() |
||
72 | |||
73 | /** |
||
74 | * Private constructor to prevent instantiation |
||
75 | */ |
||
76 | private function __construct() |
||
80 | |||
81 | private function init() |
||
87 | |||
88 | private function get_url( $path ) |
||
93 | } |
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: