1 | <?php |
||
20 | class Framework { |
||
21 | /** |
||
22 | * Flag whether the framework has been booted |
||
23 | * |
||
24 | * @var boolean |
||
25 | */ |
||
26 | protected static $booted = false; |
||
27 | |||
28 | /** |
||
29 | * IoC container |
||
30 | * |
||
31 | * @var Container |
||
32 | */ |
||
33 | protected static $container = null; |
||
34 | |||
35 | /** |
||
36 | * Return whether WordPress is in debug mode |
||
37 | * |
||
38 | * @return boolean |
||
39 | */ |
||
40 | 1 | public static function debugging() { |
|
43 | |||
44 | /** |
||
45 | * Return whether the framework has been booted |
||
46 | * |
||
47 | * @return boolean |
||
48 | */ |
||
49 | 1 | public static function isBooted() { |
|
52 | |||
53 | /** |
||
54 | * Throw an exception if the framework has not been booted |
||
55 | * |
||
56 | * @throws Exception |
||
57 | * @return null |
||
58 | */ |
||
59 | protected static function verifyBoot() { |
||
64 | |||
65 | /** |
||
66 | * Return the IoC container instance |
||
67 | * |
||
68 | * @return Container |
||
69 | */ |
||
70 | 2 | public static function getContainer() { |
|
76 | |||
77 | /** |
||
78 | * Boot the framework |
||
79 | * WordPress's 'init' action is a good place to call this |
||
80 | * |
||
81 | * @param array $config |
||
82 | * @throws Exception |
||
83 | * @return null |
||
84 | */ |
||
85 | 1 | public static function boot( $config = [] ) { |
|
109 | |||
110 | /** |
||
111 | * Register and boot all service providers |
||
112 | * |
||
113 | * @param Container $container |
||
114 | * @return null |
||
115 | */ |
||
116 | protected static function loadServiceProviders( $container ) { |
||
126 | |||
127 | /** |
||
128 | * Register all service providers |
||
129 | * |
||
130 | * @param Container $container |
||
131 | * @return null |
||
132 | */ |
||
133 | protected static function registerServiceProviders( $service_providers, $container ) { |
||
138 | |||
139 | /** |
||
140 | * Boot all service providers |
||
141 | * |
||
142 | * @param Container $container |
||
143 | * @return null |
||
144 | */ |
||
145 | protected static function bootServiceProviders( $service_providers, $container ) { |
||
150 | |||
151 | /** |
||
152 | * Register a facade class |
||
153 | * |
||
154 | * @param string $alias |
||
155 | * @param string $facade_class |
||
156 | * @return null |
||
157 | */ |
||
158 | 1 | public static function facade( $alias, $facade_class ) { |
|
161 | |||
162 | /** |
||
163 | * Resolve a dependency from the IoC container |
||
164 | * |
||
165 | * @param string $key |
||
166 | * @return mixed|null |
||
167 | */ |
||
168 | 2 | public static function resolve( $key ) { |
|
177 | |||
178 | /** |
||
179 | * Create and return a class instance |
||
180 | * |
||
181 | * @param string $class |
||
182 | * @return object |
||
183 | */ |
||
184 | 2 | public static function instantiate( $class ) { |
|
195 | |||
196 | /** |
||
197 | * Send output based on a response object |
||
198 | * |
||
199 | * @codeCoverageIgnore |
||
200 | * @param ResponseInterface $response |
||
201 | * @return null |
||
202 | */ |
||
203 | public static function respond( ResponseInterface $response ) { |
||
206 | } |
||
207 |