Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsn committed Dec 27, 2023
1 parent 6887cc9 commit fecb2e9
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/Minifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,15 @@ public function deploy(string $mode = 'all'): bool
throw MinifierException::forIncorrectDeploymentMode($mode);
}

$files = [];

try {
switch ($mode) {
case 'js':
$files = $this->deployFiles('js', $this->config->js, $this->config->dirJs, $this->config->dirMinJs);
break;

case 'css':
$files = $this->deployFiles('css', $this->config->css, $this->config->dirCss, $this->config->dirMinCss);
break;

default:
$files['js'] = $this->deployFiles('js', $this->config->js, $this->config->dirJs, $this->config->dirMinJs);
$files['css'] = $this->deployFiles('css', $this->config->css, $this->config->dirCss, $this->config->dirMinCss);
}
$files = match ($mode) {
'js' => $this->deployFiles('js', $this->config->js, $this->config->dirJs, $this->config->dirMinJs),
'css' => $this->deployFiles('css', $this->config->css, $this->config->dirCss, $this->config->dirMinCss),
default => [
'js' => $this->deployFiles('js', $this->config->js, $this->config->dirJs, $this->config->dirMinJs),
'css' => $this->deployFiles('css', $this->config->css, $this->config->dirCss, $this->config->dirMinCss),
],
};

$this->setVersion($mode, $files, $this->config->dirVersion);

Expand Down

0 comments on commit fecb2e9

Please sign in to comment.