Skip to content

Commit

Permalink
ref: baseUrl as class var
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Oct 11, 2024
1 parent 5e2d5a3 commit 5197cbc
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class UploadAssetsCommand extends AbstractLocalCommand
private const OPTION_AS_STYLE_SET_ASSETS = 'as-style-set-assets';
private ?string $filename;
private bool $updateStyleSets;
private string $baseUrl;

public function __construct(EnvironmentHelper $environmentHelper, LocalHelper $localHelper, private readonly ?string $assetLocalFolder)
{
Expand All @@ -42,18 +43,12 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
parent::initialize($input, $output);
$this->filename = $this->getOptionStringNull(self::OPTION_FILENAME);
$this->updateStyleSets = $this->getOptionBool(self::OPTION_AS_STYLE_SET_ASSETS);
$this->baseUrl = $this->getArgumentStringNull(self::ARG_BASE_URL) ?? $this->assetLocalFolder ?? $this->environment->getAlias();
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io->title('Local development - Upload assets');
$baseUrl = $input->getArgument(self::ARG_BASE_URL);
if (!\is_string($baseUrl)) {
$baseUrl = $this->assetLocalFolder;
}
if (!\is_string($baseUrl)) {
$baseUrl = $this->environment->getAlias();
}

if (!$this->coreApi->isAuthenticated()) {
$this->io->error(\sprintf('Not authenticated for %s, run emsch:local:login', $this->coreApi->getBaseUrl()));
Expand All @@ -62,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

try {
$assetsArchive = $this->localHelper->makeAssetsArchives($baseUrl);
$assetsArchive = $this->localHelper->makeAssetsArchives($this->baseUrl);
} catch (\Throwable $e) {
$this->io->error($e->getMessage());

Expand Down

0 comments on commit 5197cbc

Please sign in to comment.