@@ -11,9 +11,13 @@ class Application extends \WpStarter\Foundation\Application
1111 *
1212 * @var string
1313 */
14- const VERSION = '1.9.9 ' ;
15-
16- protected $ bootstrappedList = [];
14+ const VERSION = '1.9.10 ' ;
15+ /**
16+ * Indicates if the application has been early bootstrapped before.
17+ *
18+ * @var bool
19+ */
20+ protected $ hasBeenEarlyBootstrapped = false ;
1721
1822 protected function registerBaseServiceProviders ()
1923 {
@@ -30,22 +34,30 @@ public function registerCoreContainerAliases()
3034 $ this ->alias ('app ' ,self ::class);
3135 }
3236
33- function bootstrapWith (array $ bootstrappers )
37+ /**
38+ * Run the given array of bootstrap classes.
39+ *
40+ * @param string[] $bootstrappers
41+ * @return void
42+ */
43+ public function earlyBootstrapWith (array $ bootstrappers )
3444 {
35- $ this ->hasBeenBootstrapped = true ;
36-
45+ $ this ->hasBeenEarlyBootstrapped = true ;
3746 foreach ($ bootstrappers as $ bootstrapper ) {
38- $ this ->bootstrapOne ($ bootstrapper );
39- }
40- }
47+ $ this ['events ' ]->dispatch ('bootstrapping: ' .$ bootstrapper , [$ this ]);
4148
42- function bootstrapOne ($ bootstrapper )
43- {
44- if (!isset ($ this ->bootstrappedList [$ bootstrapper ])) {
45- $ this ->bootstrappedList [$ bootstrapper ] = true ;
46- $ this ['events ' ]->dispatch ('bootstrapping: ' . $ bootstrapper , [$ this ]);
4749 $ this ->make ($ bootstrapper )->bootstrap ($ this );
48- $ this ['events ' ]->dispatch ('bootstrapped: ' . $ bootstrapper , [$ this ]);
50+
51+ $ this ['events ' ]->dispatch ('bootstrapped: ' .$ bootstrapper , [$ this ]);
4952 }
5053 }
54+ /**
55+ * Determine if the application has been early bootstrapped before.
56+ *
57+ * @return bool
58+ */
59+ public function hasBeenEarlyBootstrapped ()
60+ {
61+ return $ this ->hasBeenEarlyBootstrapped ;
62+ }
5163}
0 commit comments