From 0e3927f56dc08d9fd4351409053bce016b4dc36b Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Sat, 30 Mar 2024 15:01:14 -0400 Subject: [PATCH] Use constant --- src/Util/ArgumentProcessor.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Util/ArgumentProcessor.php b/src/Util/ArgumentProcessor.php index f42c2c4..69bd684 100644 --- a/src/Util/ArgumentProcessor.php +++ b/src/Util/ArgumentProcessor.php @@ -13,6 +13,9 @@ */ class ArgumentProcessor { + + const SHORT_OPTION = '-short'; + /** * selectArgs selects the appropriate set of arguments for the command * to be executed and orders them as needed. @@ -28,7 +31,7 @@ class ArgumentProcessor public function selectArgs(SiteAliasInterface $siteAlias, $args, $options = [], $optionsPassedAsArgs = []) { // Split args into three arrays separated by the `--` - list($leadingArgs, $dashDash, $remaingingArgs) = $this->findArgSeparator($args); + [$leadingArgs, $dashDash, $remaingingArgs] = $this->findArgSeparator($args); $convertedOptions = $this->convertOptions($options); $convertedOptionsPassedAsArgs = $this->convertOptions($optionsPassedAsArgs); @@ -83,7 +86,7 @@ protected function convertOptions($options) foreach ($options as $option => $value) { if ($value === true || $value === null) { $result[] = "--$option"; - } elseif ($value === '-short') { + } elseif ($value === self::SHORT_OPTION) { $result[] = "-$option"; } elseif ($value === false) { // Ignore this option.