29
29
*/
30
30
class HydeKernel implements HydeKernelContract, Arrayable, \JsonSerializable
31
31
{
32
+ use Foundation \Concerns \HandlesFoundationCollections;
32
33
use Foundation \Concerns \ImplementsStringHelpers;
33
34
use Foundation \Concerns \ForwardsHyperlinks;
34
35
use Foundation \Concerns \ForwardsFilesystem;
36
+ use Foundation \Concerns \ManagesHydeKernel;
35
37
36
38
use JsonSerializesArrayable;
37
39
use Macroable;
@@ -56,40 +58,11 @@ public function __construct(?string $basePath = null)
56
58
$ this ->hyperlinks = new Hyperlinks ($ this );
57
59
}
58
60
59
- public function boot (): void
60
- {
61
- $ this ->booted = true ;
62
-
63
- $ this ->files = FileCollection::boot ($ this );
64
- $ this ->pages = PageCollection::boot ($ this );
65
- $ this ->routes = RouteCollection::boot ($ this );
66
- }
67
-
68
- public static function setInstance (HydeKernel $ instance ): void
69
- {
70
- static ::$ instance = $ instance ;
71
- }
72
-
73
- public static function getInstance (): HydeKernel
74
- {
75
- return static ::$ instance ;
76
- }
77
-
78
61
public static function version (): string
79
62
{
80
63
return InstalledVersions::getPrettyVersion ('hyde/framework ' ) ?: 'unreleased ' ;
81
64
}
82
65
83
- public function getBasePath (): string
84
- {
85
- return $ this ->basePath ;
86
- }
87
-
88
- public function setBasePath (string $ basePath ): void
89
- {
90
- $ this ->basePath = rtrim ($ basePath , '/ \\' );
91
- }
92
-
93
66
public function features (): Features
94
67
{
95
68
return new Features ;
@@ -110,27 +83,6 @@ public function currentRoute(): ?RouteContract
110
83
return View::shared ('currentRoute ' );
111
84
}
112
85
113
- public function files (): FileCollection
114
- {
115
- $ this ->needsToBeBooted ();
116
-
117
- return $ this ->files ;
118
- }
119
-
120
- public function pages (): PageCollection
121
- {
122
- $ this ->needsToBeBooted ();
123
-
124
- return $ this ->pages ;
125
- }
126
-
127
- public function routes (): RouteCollection
128
- {
129
- $ this ->needsToBeBooted ();
130
-
131
- return $ this ->routes ;
132
- }
133
-
134
86
/**
135
87
* @inheritDoc
136
88
*
@@ -146,11 +98,4 @@ public function toArray(): array
146
98
'routes ' => $ this ->routes (),
147
99
];
148
100
}
149
-
150
- protected function needsToBeBooted (): void
151
- {
152
- if (! $ this ->booted ) {
153
- $ this ->boot ();
154
- }
155
- }
156
101
}
0 commit comments