Skip to content

Commit

Permalink
Use constants
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Jul 22, 2024
1 parent 55f5c5f commit 998eef5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/N98/Magento/Command/AbstractMagentoStoreConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@
*/
abstract class AbstractMagentoStoreConfigCommand extends AbstractMagentoCommand
{
public const COMMAND_ARGUMENT_STORE = 'store';

public const COMMAND_OPTION_OFF = 'off';

public const COMMAND_OPTION_ON = 'on';

public const COMMAND_OPTION_GLOBAL = 'global';

/**
* @var string
*/
Expand Down Expand Up @@ -110,7 +114,7 @@ protected function configure(): void

if ($this->scope == self::SCOPE_STORE_VIEW_GLOBAL) {
$this->addOption(
'global',
self::COMMAND_OPTION_GLOBAL,
null,
InputOption::VALUE_NONE,
'Set value on default scope'
Expand All @@ -119,7 +123,7 @@ protected function configure(): void

if ($this->scope == self::SCOPE_STORE_VIEW || $this->scope == self::SCOPE_STORE_VIEW_GLOBAL) {
$this->addArgument(
'store',
self::COMMAND_ARGUMENT_STORE,
InputArgument::OPTIONAL,
'Store code or ID'
);
Expand Down Expand Up @@ -158,7 +162,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$runOnStoreView = false;
if ($this->scope == self::SCOPE_STORE_VIEW
|| ($this->scope == self::SCOPE_STORE_VIEW_GLOBAL && !$input->getOption('global'))
|| ($this->scope == self::SCOPE_STORE_VIEW_GLOBAL && !$input->getOption(self::COMMAND_OPTION_GLOBAL))
) {
$runOnStoreView = true;
}
Expand Down Expand Up @@ -283,7 +287,7 @@ protected function setDeveloperIp(Mage_Core_Model_Store $store, string $newDevel
protected function _initStore(InputInterface $input, OutputInterface $output)
{
$parameterHelper = $this->getParameterHelper();
return $parameterHelper->askStore($input, $output, 'store', $this->withAdminStore);
return $parameterHelper->askStore($input, $output, self::COMMAND_ARGUMENT_STORE, $this->withAdminStore);
}

/**
Expand Down

0 comments on commit 998eef5

Please sign in to comment.