File tree Expand file tree Collapse file tree 3 files changed +40
-4
lines changed
Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Hyde \Foundation \Providers ;
6+
7+ use Hyde \Framework \Services \YamlConfigurationService ;
8+ use Illuminate \Support \ServiceProvider ;
9+
10+ class ConfigurationServiceProvider extends ServiceProvider
11+ {
12+ /**
13+ * Run any logic before the Hyde Service Provider is registered.
14+ */
15+ public function initialize (): void
16+ {
17+ if (YamlConfigurationService::hasFile ()) {
18+ YamlConfigurationService::boot ();
19+ }
20+ }
21+
22+ public function register (): void
23+ {
24+ //
25+ }
26+
27+ public function boot (): void
28+ {
29+ //
30+ }
31+ }
Original file line number Diff line number Diff line change 77use Hyde \Console \HydeConsoleServiceProvider ;
88use Hyde \Facades \Features ;
99use Hyde \Foundation \HydeKernel ;
10+ use Hyde \Foundation \Providers \ConfigurationServiceProvider ;
1011use Hyde \Framework \Concerns \RegistersFileLocations ;
1112use Hyde \Framework \Services \AssetService ;
12- use Hyde \Framework \Services \YamlConfigurationService ;
1313use Hyde \Framework \Views \Components \LinkComponent ;
1414use Hyde \Hyde ;
1515use Hyde \Markdown \MarkdownConverter ;
@@ -112,9 +112,8 @@ public function boot(): void
112112
113113 protected function initializeConfiguration (): void
114114 {
115- if (YamlConfigurationService::hasFile ()) {
116- YamlConfigurationService::boot ();
117- }
115+ $ this ->app ->register (ConfigurationServiceProvider::class);
116+ $ this ->getConfigurationProvider ()->initialize ();
118117 }
119118
120119 /**
@@ -152,4 +151,9 @@ protected function registerModuleServiceProviders(): void
152151 {
153152 $ this ->app ->register (HydeConsoleServiceProvider::class);
154153 }
154+
155+ protected function getConfigurationProvider (): ServiceProvider |ConfigurationServiceProvider
156+ {
157+ return $ this ->app ->getProvider (ConfigurationServiceProvider::class);
158+ }
155159}
Original file line number Diff line number Diff line change 3333/**
3434 * @covers \Hyde\Framework\HydeServiceProvider
3535 * @covers \Hyde\Framework\Concerns\RegistersFileLocations
36+ * @covers \Hyde\Foundation\Providers\ConfigurationServiceProvider
3637 */
3738class HydeServiceProviderTest extends TestCase
3839{
You can’t perform that action at this time.
0 commit comments