1 | <?php |
||
40 | final class Core |
||
41 | { |
||
42 | /** |
||
43 | * The current version of Cervo. |
||
44 | */ |
||
45 | const VERSION = '4.0.0'; |
||
46 | |||
47 | /** |
||
48 | * All the libraries instances that have been initialized through getLibrary(). |
||
49 | * @var array |
||
50 | */ |
||
51 | private static $libraries = []; |
||
52 | |||
53 | /** |
||
54 | * All the library classes to be used whend not found in the application through getLibrary(). |
||
55 | * @var array |
||
56 | */ |
||
57 | private static $injected_libraries = []; |
||
58 | |||
59 | /** |
||
60 | * All the controller instances that have been initialized through getController(). |
||
61 | * @var array |
||
62 | */ |
||
63 | private static $controllers = []; |
||
64 | |||
65 | /** |
||
66 | * All the controller classes to be used when not found in the application through getController(). |
||
67 | * @var array |
||
68 | */ |
||
69 | private static $injected_controllers = []; |
||
70 | |||
71 | /** |
||
72 | * If Cervo have been initialized. |
||
73 | * @var bool |
||
74 | */ |
||
75 | private static $is_init = false; |
||
76 | |||
77 | /** |
||
78 | * If the configuration/autoloaders have been initialized. |
||
79 | * @var bool |
||
80 | */ |
||
81 | private static $is_init_config = false; |
||
82 | |||
83 | /** |
||
84 | * Initialize Cervo. |
||
85 | * |
||
86 | * @param string|null $json_config_file The path to the JSON configuration file to use. |
||
87 | */ |
||
88 | public static function init(?string $json_config_file = null) : void |
||
142 | |||
143 | public static function getInjectedLibraries() : array |
||
147 | |||
148 | public static function getInjectedControllers() : array |
||
152 | |||
153 | /** |
||
154 | * Initialize the configuration for Cervo with default configs. |
||
155 | * |
||
156 | * @param string|null $json_config_file |
||
157 | */ |
||
158 | public static function initConfig(?string $json_config_file = null) : void |
||
194 | |||
195 | /** |
||
196 | * First iteration of a provider interface to inject elements into Cervo. |
||
197 | * |
||
198 | * @param ProviderInterface $provider |
||
199 | */ |
||
200 | public static function register(ProviderInterface $provider) |
||
204 | |||
205 | /** |
||
206 | * Return a library. It will be stored in an internal cache and reused if called again. |
||
207 | * $name format: [Module]/[Name] |
||
208 | * Name MAY contain slashes (/) to go deeper in the tree. |
||
209 | * The module name Cervo may be used to access the Cervo standard libraries. |
||
210 | * |
||
211 | * @param string $name The path name |
||
212 | * |
||
213 | * @return object |
||
214 | */ |
||
215 | public static function getLibrary(string $name) |
||
235 | |||
236 | /** |
||
237 | * Injects a library to be used in getLibrary() if not found in the application. |
||
238 | * |
||
239 | * @param string $name The path name |
||
240 | * @param string $i_name The class name |
||
241 | */ |
||
242 | public static function injectLibrary(string $name, string $i_name) |
||
246 | |||
247 | /** |
||
248 | * Return a controller. It will be stored in an internal cache and reused if called again. |
||
249 | * $name format: [Module]/[Name] |
||
250 | * $name MAY contain slashes (/) to go deeper in the tree. |
||
251 | * |
||
252 | * @param string $name The path name |
||
253 | * |
||
254 | * @return object |
||
255 | */ |
||
256 | public static function getController(string $name) |
||
270 | |||
271 | /** |
||
272 | * Injects a controller to be used in getController() if not found in the application. |
||
273 | * |
||
274 | * @param string $name The path name |
||
275 | * @param string $i_name The class name |
||
276 | */ |
||
277 | public static function injectController(string $name, string $i_name) |
||
281 | |||
282 | /** |
||
283 | * Return an instanciated object depending on the module sub-folder. |
||
284 | * $class_path format: [Module]/[Name] |
||
285 | * $class_path MAY contain slashes (/) to go deeper in the tree. |
||
286 | * $application_path is the module sub-folder to look in for. |
||
287 | * |
||
288 | * @param string $name The path name |
||
289 | * @param string $application_path The sub-folder within the module |
||
290 | * |
||
291 | * @return object |
||
292 | */ |
||
293 | public static function getPath(string $name, string $application_path) |
||
305 | |||
306 | /** |
||
307 | * Return a template. |
||
308 | * $name format: [Module]/[Name] |
||
309 | * Name MAY contain slashes (/) to go deeper in the tree. |
||
310 | * |
||
311 | * @param string $name The path name |
||
312 | * |
||
313 | * @return Template |
||
314 | */ |
||
315 | public static function getTemplate(string $name) : Template |
||
319 | |||
320 | /** |
||
321 | * The default class autoloader. |
||
322 | * Also run any additional autoloaders added with register_autoload(). |
||
323 | * |
||
324 | * @param string $name The class full name (Include the namespace(s)) |
||
325 | */ |
||
326 | public static function autoload(string $name) : void |
||
340 | } |
||
341 |