@@ -18,20 +18,6 @@ class Minifier
18
18
*/
19
19
public function __construct (protected MinifierConfig $ config )
20
20
{
21
- // Make some checks for backward compatibility
22
- // just in case someone doesn't publish/update
23
- // their configuration file
24
- if (! isset ($ this ->config ->baseJsUrl )) {
25
- $ this ->config ->baseJsUrl = null ;
26
- }
27
-
28
- if (! isset ($ this ->config ->baseCssUrl )) {
29
- $ this ->config ->baseCssUrl = null ;
30
- }
31
-
32
- if (! isset ($ this ->config ->returnType )) {
33
- $ this ->config ->returnType = 'html ' ;
34
- }
35
21
}
36
22
37
23
/**
@@ -137,7 +123,7 @@ protected function autoDeployCheckFile(string $fileType, string $filename): bool
137
123
}
138
124
139
125
$ assets = [$ filename => $ this ->config ->{$ fileType }[$ filename ]];
140
- $ filePath = $ this ->config ->{$ dirMin } . ' / ' . $ filename ;
126
+ $ filePath = $ this ->config ->{$ dirMin } . DIRECTORY_SEPARATOR . $ filename ;
141
127
142
128
// if file is not deployed
143
129
if (! file_exists ($ filePath )) {
@@ -151,7 +137,7 @@ protected function autoDeployCheckFile(string $fileType, string $filename): bool
151
137
152
138
// loop though the files and check last update time
153
139
foreach ($ assets [$ filename ] as $ file ) {
154
- $ currentFileTime = filemtime ($ this ->config ->{$ dir } . ' / ' . $ file );
140
+ $ currentFileTime = filemtime ($ this ->config ->{$ dir } . DIRECTORY_SEPARATOR . $ file );
155
141
if ($ currentFileTime > $ lastDeployTime ) {
156
142
$ this ->deployFiles ($ fileType , $ assets , $ this ->config ->{$ dir }, $ this ->config ->{$ dirMin });
157
143
@@ -231,13 +217,13 @@ protected function getVersion(string $dir): array
231
217
232
218
// load all versions numbers
233
219
if ($ versions === null ) {
234
- $ dir = rtrim ($ dir , ' / ' );
220
+ $ dir = rtrim ($ dir , DIRECTORY_SEPARATOR );
235
221
236
- if (! file_exists ($ dir . ' / versions.json ' )) {
222
+ if (! file_exists ($ dir . DIRECTORY_SEPARATOR . ' versions.json ' )) {
237
223
throw MinifierException::forNoVersioningFile ();
238
224
}
239
225
240
- $ versions = json_decode (file_get_contents ($ dir . ' / versions.json ' ), true );
226
+ $ versions = json_decode (file_get_contents ($ dir . DIRECTORY_SEPARATOR . ' versions.json ' ), true );
241
227
}
242
228
243
229
return $ versions ;
@@ -253,10 +239,10 @@ protected function getVersion(string $dir): array
253
239
protected function setVersion (string $ mode , array $ files , string $ dir ): void
254
240
{
255
241
$ versions = [];
256
- $ dir = rtrim ($ dir , ' / ' );
242
+ $ dir = rtrim ($ dir , DIRECTORY_SEPARATOR );
257
243
258
- if (file_exists ($ dir . ' / versions.json ' )) {
259
- $ versions = json_decode (file_get_contents ($ dir . ' / versions.json ' ), true );
244
+ if (file_exists ($ dir . DIRECTORY_SEPARATOR . ' versions.json ' )) {
245
+ $ versions = json_decode (file_get_contents ($ dir . DIRECTORY_SEPARATOR . ' versions.json ' ), true );
260
246
}
261
247
262
248
if ($ mode === 'all ' ) {
@@ -265,7 +251,7 @@ protected function setVersion(string $mode, array $files, string $dir): void
265
251
$ versions [$ mode ] = $ files ;
266
252
}
267
253
268
- file_put_contents ($ dir . ' / versions.json ' , json_encode ($ versions ));
254
+ file_put_contents ($ dir . DIRECTORY_SEPARATOR . ' versions.json ' , json_encode ($ versions ));
269
255
}
270
256
271
257
/**
0 commit comments