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 | * Return whether WordPress is in debug mode |
||
38 | * |
||
39 | * @return boolean |
||
40 | */ |
||
41 | 1 | public static function debugging() { |
|
44 | |||
45 | /** |
||
46 | * Return whether the framework has been booted |
||
47 | * |
||
48 | * @return boolean |
||
49 | */ |
||
50 | 1 | public static function isBooted() { |
|
53 | |||
54 | /** |
||
55 | * Throw an exception if the framework has not been booted |
||
56 | * |
||
57 | * @throws Exception |
||
58 | * @return null |
||
59 | */ |
||
60 | protected static function verifyBoot() { |
||
65 | |||
66 | /** |
||
67 | * Return the IoC container instance |
||
68 | * |
||
69 | * @return Container |
||
70 | */ |
||
71 | 2 | public static function getContainer() { |
|
77 | |||
78 | /** |
||
79 | * Boot the framework |
||
80 | * WordPress's 'init' action is a good place to call this |
||
81 | * |
||
82 | * @param array $config |
||
83 | * @throws Exception |
||
84 | * @return null |
||
85 | */ |
||
86 | 1 | public static function boot( $config = [] ) { |
|
111 | |||
112 | /** |
||
113 | * Register and boot all service providers |
||
114 | * |
||
115 | * @param Container $container |
||
116 | * @return null |
||
117 | */ |
||
118 | protected static function loadServiceProviders( $container ) { |
||
128 | |||
129 | /** |
||
130 | * Register all service providers |
||
131 | * |
||
132 | * @param Container $container |
||
133 | * @return null |
||
134 | */ |
||
135 | protected static function registerServiceProviders( $service_providers, $container ) { |
||
140 | |||
141 | /** |
||
142 | * Boot all service providers |
||
143 | * |
||
144 | * @param Container $container |
||
145 | * @return null |
||
146 | */ |
||
147 | protected static function bootServiceProviders( $service_providers, $container ) { |
||
152 | |||
153 | /** |
||
154 | * Register a facade class |
||
155 | * |
||
156 | * @param string $alias |
||
157 | * @param string $facade_class |
||
158 | * @return null |
||
159 | */ |
||
160 | 1 | public static function facade( $alias, $facade_class ) { |
|
163 | |||
164 | /** |
||
165 | * Resolve a dependency from the IoC container |
||
166 | * |
||
167 | * @param string $key |
||
168 | * @return mixed|null |
||
169 | */ |
||
170 | 2 | public static function resolve( $key ) { |
|
179 | |||
180 | /** |
||
181 | * Create and return a class instance |
||
182 | * |
||
183 | * @param string $class |
||
184 | * @return object |
||
185 | */ |
||
186 | 2 | public static function instantiate( $class ) { |
|
197 | |||
198 | /** |
||
199 | * Send output based on a response object |
||
200 | * |
||
201 | * @codeCoverageIgnore |
||
202 | * @param ResponseInterface $response |
||
203 | * @return null |
||
204 | */ |
||
205 | public static function respond( ResponseInterface $response ) { |
||
208 | } |
||
209 |