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 | * @codeCoverageIgnore |
||
71 | * @throws Exception |
||
72 | * @return null |
||
73 | */ |
||
74 | protected static function verifyBoot() { |
||
79 | |||
80 | /** |
||
81 | * Return the IoC container instance |
||
82 | * |
||
83 | * @return Container |
||
84 | */ |
||
85 | 2 | public static function getContainer() { |
|
93 | |||
94 | /** |
||
95 | * Boot the framework |
||
96 | * WordPress's 'after_setup_theme' action is a good place to call this |
||
97 | * |
||
98 | * @codeCoverageIgnore |
||
99 | * @param array $config |
||
100 | * @throws Exception |
||
101 | * @return null |
||
102 | */ |
||
103 | public static function boot( $config = [] ) { |
||
125 | |||
126 | /** |
||
127 | * Register and boot all service providers |
||
128 | * |
||
129 | * @codeCoverageIgnore |
||
130 | * @param Container $container |
||
131 | * @return null |
||
132 | */ |
||
133 | protected static function loadServiceProviders( $container ) { |
||
146 | |||
147 | /** |
||
148 | * Register all service providers |
||
149 | * |
||
150 | * @codeCoverageIgnore |
||
151 | * @param Container $container |
||
152 | * @return null |
||
153 | */ |
||
154 | protected static function registerServiceProviders( $service_providers, $container ) { |
||
159 | |||
160 | /** |
||
161 | * Boot all service providers |
||
162 | * |
||
163 | * @codeCoverageIgnore |
||
164 | * @param Container $container |
||
165 | * @return null |
||
166 | */ |
||
167 | protected static function bootServiceProviders( $service_providers, $container ) { |
||
172 | |||
173 | /** |
||
174 | * Register a facade class |
||
175 | * |
||
176 | * @param string $alias |
||
177 | * @param string $facade_class |
||
178 | * @return null |
||
179 | */ |
||
180 | 1 | public static function facade( $alias, $facade_class ) { |
|
183 | |||
184 | /** |
||
185 | * Resolve a dependency from the IoC container |
||
186 | * |
||
187 | * @param string $key |
||
188 | * @return mixed|null |
||
189 | */ |
||
190 | 2 | public static function resolve( $key ) { |
|
199 | |||
200 | /** |
||
201 | * Create and return a class instance |
||
202 | * |
||
203 | * @param string $class |
||
204 | * @return object |
||
205 | */ |
||
206 | 2 | public static function instantiate( $class ) { |
|
217 | |||
218 | /** |
||
219 | * Send output based on a response object |
||
220 | * |
||
221 | * @codeCoverageIgnore |
||
222 | * @param ResponseInterface $response |
||
223 | * @return null |
||
224 | */ |
||
225 | public static function respond( ResponseInterface $response ) { |
||
228 | } |
||
229 |