1 | <?php |
||
21 | class Framework { |
||
22 | /** |
||
23 | * Flag whether the framework has been booted |
||
24 | * |
||
25 | * @var boolean |
||
26 | */ |
||
27 | protected static $booted = false; |
||
28 | |||
29 | /** |
||
30 | * IoC container |
||
31 | * |
||
32 | * @var Container |
||
33 | */ |
||
34 | protected static $container = null; |
||
35 | |||
36 | /** |
||
37 | * Array of framework service providers |
||
38 | * |
||
39 | * @var string[] |
||
40 | */ |
||
41 | protected static $service_proviers = [ |
||
42 | RoutingServiceProvider::class, |
||
43 | FlashServiceProvider::class, |
||
44 | OldInputServiceProvider::class, |
||
45 | TemplatingServiceProvider::class, |
||
46 | ControllersServiceProvider::class, |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * Return whether WordPress is in debug mode |
||
51 | * |
||
52 | * @return boolean |
||
53 | */ |
||
54 | 1 | public static function debugging() { |
|
57 | |||
58 | /** |
||
59 | * Return whether the framework has been booted |
||
60 | * |
||
61 | * @return boolean |
||
62 | */ |
||
63 | 1 | public static function isBooted() { |
|
66 | |||
67 | /** |
||
68 | * Throw an exception if the framework has not been booted |
||
69 | * |
||
70 | * @throws Exception |
||
71 | * @return null |
||
72 | */ |
||
73 | protected static function verifyBoot() { |
||
78 | |||
79 | /** |
||
80 | * Return the IoC container instance |
||
81 | * |
||
82 | * @return Container |
||
83 | */ |
||
84 | 2 | public static function getContainer() { |
|
90 | |||
91 | /** |
||
92 | * Boot the framework |
||
93 | * WordPress's 'init' action is a good place to call this |
||
94 | * |
||
95 | * @param array $config |
||
96 | * @throws Exception |
||
97 | * @return null |
||
98 | */ |
||
99 | 1 | public static function boot( $config = [] ) { |
|
121 | |||
122 | /** |
||
123 | * Register and boot all service providers |
||
124 | * |
||
125 | * @param Container $container |
||
126 | * @return null |
||
127 | */ |
||
128 | protected static function loadServiceProviders( $container ) { |
||
141 | |||
142 | /** |
||
143 | * Register all service providers |
||
144 | * |
||
145 | * @param Container $container |
||
146 | * @return null |
||
147 | */ |
||
148 | protected static function registerServiceProviders( $service_providers, $container ) { |
||
153 | |||
154 | /** |
||
155 | * Boot all service providers |
||
156 | * |
||
157 | * @param Container $container |
||
158 | * @return null |
||
159 | */ |
||
160 | protected static function bootServiceProviders( $service_providers, $container ) { |
||
165 | |||
166 | /** |
||
167 | * Register a facade class |
||
168 | * |
||
169 | * @param string $alias |
||
170 | * @param string $facade_class |
||
171 | * @return null |
||
172 | */ |
||
173 | 1 | public static function facade( $alias, $facade_class ) { |
|
176 | |||
177 | /** |
||
178 | * Resolve a dependency from the IoC container |
||
179 | * |
||
180 | * @param string $key |
||
181 | * @return mixed|null |
||
182 | */ |
||
183 | 2 | public static function resolve( $key ) { |
|
192 | |||
193 | /** |
||
194 | * Create and return a class instance |
||
195 | * |
||
196 | * @param string $class |
||
197 | * @return object |
||
198 | */ |
||
199 | 2 | public static function instantiate( $class ) { |
|
210 | |||
211 | /** |
||
212 | * Send output based on a response object |
||
213 | * |
||
214 | * @codeCoverageIgnore |
||
215 | * @param ResponseInterface $response |
||
216 | * @return null |
||
217 | */ |
||
218 | public static function respond( ResponseInterface $response ) { |
||
221 | } |
||
222 |