Skip to content

Commit fbd56a1

Browse files
committed
cleanup
1 parent fecb2e9 commit fbd56a1

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

src/Minifier.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@ class Minifier
1818
*/
1919
public function __construct(protected MinifierConfig $config)
2020
{
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-
}
3521
}
3622

3723
/**
@@ -137,7 +123,7 @@ protected function autoDeployCheckFile(string $fileType, string $filename): bool
137123
}
138124

139125
$assets = [$filename => $this->config->{$fileType}[$filename]];
140-
$filePath = $this->config->{$dirMin} . '/' . $filename;
126+
$filePath = $this->config->{$dirMin} . DIRECTORY_SEPARATOR . $filename;
141127

142128
// if file is not deployed
143129
if (! file_exists($filePath)) {
@@ -151,7 +137,7 @@ protected function autoDeployCheckFile(string $fileType, string $filename): bool
151137

152138
// loop though the files and check last update time
153139
foreach ($assets[$filename] as $file) {
154-
$currentFileTime = filemtime($this->config->{$dir} . '/' . $file);
140+
$currentFileTime = filemtime($this->config->{$dir} . DIRECTORY_SEPARATOR . $file);
155141
if ($currentFileTime > $lastDeployTime) {
156142
$this->deployFiles($fileType, $assets, $this->config->{$dir}, $this->config->{$dirMin});
157143

@@ -231,13 +217,13 @@ protected function getVersion(string $dir): array
231217

232218
// load all versions numbers
233219
if ($versions === null) {
234-
$dir = rtrim($dir, '/');
220+
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
235221

236-
if (! file_exists($dir . '/versions.json')) {
222+
if (! file_exists($dir . DIRECTORY_SEPARATOR . 'versions.json')) {
237223
throw MinifierException::forNoVersioningFile();
238224
}
239225

240-
$versions = json_decode(file_get_contents($dir . '/versions.json'), true);
226+
$versions = json_decode(file_get_contents($dir . DIRECTORY_SEPARATOR . 'versions.json'), true);
241227
}
242228

243229
return $versions;
@@ -253,10 +239,10 @@ protected function getVersion(string $dir): array
253239
protected function setVersion(string $mode, array $files, string $dir): void
254240
{
255241
$versions = [];
256-
$dir = rtrim($dir, '/');
242+
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
257243

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);
260246
}
261247

262248
if ($mode === 'all') {
@@ -265,7 +251,7 @@ protected function setVersion(string $mode, array $files, string $dir): void
265251
$versions[$mode] = $files;
266252
}
267253

268-
file_put_contents($dir . '/versions.json', json_encode($versions));
254+
file_put_contents($dir . DIRECTORY_SEPARATOR . 'versions.json', json_encode($versions));
269255
}
270256

271257
/**

0 commit comments

Comments
 (0)