Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
passchn committed Jan 22, 2023
1 parent a10993c commit 9bd428a
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/Utilities/ManifestRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function getCss(): array
}

return array_map(function ($file) {
return $this->getLinkFromOutDirectory($file);
return $this->getLinkFromOutDirectory($file);
}, $files);
}

Expand All @@ -208,23 +208,23 @@ public function isModuleEntryScript(): bool
return $this->isEntry() && $this->isJavascript() && !$this->isLegacy() && !$this->isPolyfill();
}

/**
* Enables users to set build.outDirectory in app_vite.php to false,
* so that the outDir equals the webroot.
*
* @param string $assetLink
* @return string
*/
private function getLinkFromOutDirectory(string $assetLink): string
{
$outDirectory = $this->config->read('build.outDirectory');
if (empty($outDirectory) && false !== $outDirectory) {
$outDirectory = ConfigDefaults::BUILD_OUT_DIRECTORY;
}

$outDirectory = ltrim((string)$outDirectory, DS);
$outDirectory = $outDirectory ? DS . $outDirectory : '';

return $outDirectory . DS . $assetLink;
}
/**
* Enables users to set build.outDirectory in app_vite.php to false,
* so that the outDir equals the webroot.
*
* @param string $assetLink link to asset from manifest inside outDir
* @return string
*/
private function getLinkFromOutDirectory(string $assetLink): string
{
$outDirectory = $this->config->read('build.outDirectory');
if (empty($outDirectory) && $outDirectory !== false) {
$outDirectory = ConfigDefaults::BUILD_OUT_DIRECTORY;
}

$outDirectory = ltrim((string)$outDirectory, DS);
$outDirectory = $outDirectory ? DS . $outDirectory : '';

return $outDirectory . DS . $assetLink;
}
}

0 comments on commit 9bd428a

Please sign in to comment.