1 | <?php |
||
18 | class Dev extends Module |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Library class instance |
||
23 | * @var \gplcart\core\Library |
||
24 | */ |
||
25 | protected $library; |
||
26 | |||
27 | /** |
||
28 | * @param Library $library |
||
29 | */ |
||
30 | public function __construct(Library $library) |
||
36 | |||
37 | /** |
||
38 | * Implements hook "construct" |
||
39 | */ |
||
40 | public function hookConstruct() |
||
45 | |||
46 | /** |
||
47 | * Implements hook "construct.controller" |
||
48 | * @param \gplcart\core\Controller $object |
||
49 | */ |
||
50 | public function hookConstructController($object) |
||
57 | |||
58 | /** |
||
59 | * Implements hook "destruct" |
||
60 | */ |
||
61 | public function hookDestruct() |
||
71 | |||
72 | /** |
||
73 | * Render and print dev toolbar |
||
74 | */ |
||
75 | protected function outputToolbar() |
||
88 | |||
89 | /** |
||
90 | * Implements hook "library.list" |
||
91 | * @param array $libraries |
||
92 | */ |
||
93 | public function hookLibraryList(array &$libraries) |
||
108 | |||
109 | /** |
||
110 | * Implements hook "route.list" |
||
111 | * @param array $routes |
||
112 | */ |
||
113 | public function hookRouteList(array &$routes) |
||
122 | |||
123 | /** |
||
124 | * Implements hook "module.enable.after" |
||
125 | */ |
||
126 | public function hookModuleEnableAfter() |
||
130 | |||
131 | /** |
||
132 | * Implements hook "module.disable.after" |
||
133 | */ |
||
134 | public function hookModuleDisableAfter() |
||
138 | |||
139 | /** |
||
140 | * Implements hook "module.install.after" |
||
141 | */ |
||
142 | public function hookModuleInstallAfter() |
||
146 | |||
147 | /** |
||
148 | * Implements hook "module.uninstall.after" |
||
149 | */ |
||
150 | public function hookModuleUninstallAfter() |
||
154 | |||
155 | } |
||
156 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: