@@ -52,7 +52,7 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * @param array $commands |
|
| 55 | + * @param BaseCommand[] $commands |
|
| 56 | 56 | * |
| 57 | 57 | * @return bool |
| 58 | 58 | */ |
@@ -29,15 +29,15 @@ |
||
| 29 | 29 | * |
| 30 | 30 | * @return null|string |
| 31 | 31 | */ |
| 32 | - protected function getCommandsCacheFilePath(Composer $composer): ?string |
|
| 32 | + protected function getCommandsCacheFilePath(Composer $composer): ? string |
|
| 33 | 33 | { |
| 34 | 34 | $extra = $composer->getPackage()->getExtra(); |
| 35 | 35 | $keyApp = CommandConstants::COMPOSER_JSON__EXTRA__APPLICATION; |
| 36 | 36 | $keyCacheFile = CommandConstants::COMPOSER_JSON__EXTRA__APPLICATION__COMMANDS_CACHE; |
| 37 | 37 | $commandsCacheFile = $extra[$keyApp][$keyCacheFile] ?? null; |
| 38 | 38 | if ($commandsCacheFile !== null) { |
| 39 | - $appRootPath = $composer->getConfig()->get('vendor-dir') . DIRECTORY_SEPARATOR . '..'; |
|
| 40 | - $commandsCacheFile = realpath($appRootPath) . DIRECTORY_SEPARATOR . $commandsCacheFile; |
|
| 39 | + $appRootPath = $composer->getConfig()->get('vendor-dir').DIRECTORY_SEPARATOR.'..'; |
|
| 40 | + $commandsCacheFile = realpath($appRootPath).DIRECTORY_SEPARATOR.$commandsCacheFile; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return $commandsCacheFile; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function getAutoloadPath(Composer $composer): string |
| 83 | 83 | { |
| 84 | - return $composer->getConfig()->get('vendor-dir') . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
| 84 | + return $composer->getConfig()->get('vendor-dir').DIRECTORY_SEPARATOR.'autoload.php'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ApplicationInterface $application, |
| 119 | 119 | string $commandName |
| 120 | 120 | ): ContainerInterface { |
| 121 | - return $application->createContainer(CommandConstants::HTTP_METHOD, '/' . $commandName); |
|
| 121 | + return $application->createContainer(CommandConstants::HTTP_METHOD, '/'.$commandName); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @return string|null |
| 56 | 56 | */ |
| 57 | - public function getShortcut(): ?string |
|
| 57 | + public function getShortcut(): ? string |
|
| 58 | 58 | { |
| 59 | 59 | return $this->getData()[CommandInterface::OPTION_SHORTCUT] ?? null; |
| 60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | /** |
| 71 | 71 | * @return string|null |
| 72 | 72 | */ |
| 73 | - public function getDefault(): ?string |
|
| 73 | + public function getDefault(): ? string |
|
| 74 | 74 | { |
| 75 | 75 | $value = $this->getData()[CommandInterface::OPTION_DEFAULT] ?? null; |
| 76 | 76 | |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | /** |
| 115 | 115 | * @return int|null |
| 116 | 116 | */ |
| 117 | - public function getMode(): ?int |
|
| 117 | + public function getMode(): ? int |
|
| 118 | 118 | { |
| 119 | 119 | $mode = null; |
| 120 | 120 | |
| 121 | - $this->isNone() === false ?: $mode = (int)$mode | InputOption::VALUE_NONE; |
|
| 122 | - $this->isRequired() === false ?: $mode = (int)$mode | InputOption::VALUE_REQUIRED; |
|
| 123 | - $this->isOptional() === false ?: $mode = (int)$mode | InputOption::VALUE_OPTIONAL; |
|
| 124 | - $this->isArray() === false ?: $mode = (int)$mode | InputOption::VALUE_IS_ARRAY; |
|
| 121 | + $this->isNone() === false ?: $mode = (int) $mode | InputOption::VALUE_NONE; |
|
| 122 | + $this->isRequired() === false ?: $mode = (int) $mode | InputOption::VALUE_REQUIRED; |
|
| 123 | + $this->isOptional() === false ?: $mode = (int) $mode | InputOption::VALUE_OPTIONAL; |
|
| 124 | + $this->isArray() === false ?: $mode = (int) $mode | InputOption::VALUE_IS_ARRAY; |
|
| 125 | 125 | |
| 126 | 126 | return $mode; |
| 127 | 127 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * @return string|null |
| 60 | 60 | */ |
| 61 | - public function getDefault(): ?string |
|
| 61 | + public function getDefault(): ? string |
|
| 62 | 62 | { |
| 63 | 63 | $value = $this->getData()[CommandInterface::ARGUMENT_DEFAULT] ?? null; |
| 64 | 64 | |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * @return int|null |
| 96 | 96 | */ |
| 97 | - public function getMode(): ?int |
|
| 97 | + public function getMode(): ? int |
|
| 98 | 98 | { |
| 99 | 99 | $mode = null; |
| 100 | 100 | |
| 101 | - $this->isRequired() === false ?: $mode = (int)$mode | InputArgument::REQUIRED; |
|
| 102 | - $this->isOptional() === false ?: $mode = (int)$mode | InputArgument::OPTIONAL; |
|
| 103 | - $this->isArray() === false ?: $mode = (int)$mode | InputArgument::IS_ARRAY; |
|
| 101 | + $this->isRequired() === false ?: $mode = (int) $mode | InputArgument::REQUIRED; |
|
| 102 | + $this->isOptional() === false ?: $mode = (int) $mode | InputArgument::OPTIONAL; |
|
| 103 | + $this->isArray() === false ?: $mode = (int) $mode | InputArgument::IS_ARRAY; |
|
| 104 | 104 | |
| 105 | 105 | return $mode; |
| 106 | 106 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $connect = static::ACTION_CONNECT; |
| 80 | 80 | $create = static::ACTION_CREATE; |
| 81 | - $actionDesc = "Required action such as `$connect` to find and connect commands from application and plugins " . |
|
| 81 | + $actionDesc = "Required action such as `$connect` to find and connect commands from application and plugins ". |
|
| 82 | 82 | "or `$create` to create an empty command template."; |
| 83 | 83 | |
| 84 | 84 | $classDesc = "Required valid class name in commands' namespace for action `$create`."; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->executeCreate($container, $inOut); |
| 112 | 112 | break; |
| 113 | 113 | default: |
| 114 | - $inOut->writeError("Unknown value `$action` for argument `$argAction`." . PHP_EOL); |
|
| 114 | + $inOut->writeError("Unknown value `$action` for argument `$argAction`.".PHP_EOL); |
|
| 115 | 115 | break; |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if (class_exists($commandClass) === false || |
| 134 | 134 | array_key_exists(CommandInterface::class, class_implements($commandClass)) === false |
| 135 | 135 | ) { |
| 136 | - $inOut->writeWarning("Class `$commandClass` either do not exist or not a command class." . PHP_EOL); |
|
| 136 | + $inOut->writeWarning("Class `$commandClass` either do not exist or not a command class.".PHP_EOL); |
|
| 137 | 137 | continue; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | EOT; |
| 155 | 155 | $cacheFilePath = $this->getCommandsCacheFilePath($this->getComposer()); |
| 156 | 156 | if (empty($cacheFilePath) === true) { |
| 157 | - $inOut->writeError("Commands cache file path is not set. Check your `Application` settings." . PHP_EOL); |
|
| 157 | + $inOut->writeError("Commands cache file path is not set. Check your `Application` settings.".PHP_EOL); |
|
| 158 | 158 | return; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | $argClass = static::ARG_CLASS; |
| 174 | 174 | if ($inOut->hasArgument($argClass) === false) { |
| 175 | - $inOut->writeError("Argument `$argClass` is not provided." . PHP_EOL); |
|
| 175 | + $inOut->writeError("Argument `$argClass` is not provided.".PHP_EOL); |
|
| 176 | 176 | |
| 177 | 177 | return; |
| 178 | 178 | } |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | $commandsFolder = $settings[S::KEY_COMMANDS_FOLDER] ?? null; |
| 184 | 184 | if (empty($commandsFolder) === true || $fileSystem->isFolder($commandsFolder) === false) { |
| 185 | 185 | $inOut->writeError( |
| 186 | - "Commands folder `$commandsFolder` is not valid. Check your `Application` settings." . PHP_EOL |
|
| 186 | + "Commands folder `$commandsFolder` is not valid. Check your `Application` settings.".PHP_EOL |
|
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $classPath = $commandsFolder . DIRECTORY_SEPARATOR . $class . '.php'; |
|
| 192 | + $classPath = $commandsFolder.DIRECTORY_SEPARATOR.$class.'.php'; |
|
| 193 | 193 | if (ctype_alpha($class) === false || |
| 194 | 194 | $fileSystem->exists($classPath) === true |
| 195 | 195 | ) { |
| 196 | 196 | $inOut->writeError( |
| 197 | - "Class name `$class` does not look valid for a command. " . |
|
| 198 | - 'Can you please choose another one?' . PHP_EOL |
|
| 197 | + "Class name `$class` does not look valid for a command. ". |
|
| 198 | + 'Can you please choose another one?'.PHP_EOL |
|
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | 201 | return; |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $commandName = strtolower($class); |
| 205 | 205 | |
| 206 | - $templateContent = $fileSystem->read(__DIR__ . DIRECTORY_SEPARATOR . 'SampleCommand.txt'); |
|
| 206 | + $templateContent = $fileSystem->read(__DIR__.DIRECTORY_SEPARATOR.'SampleCommand.txt'); |
|
| 207 | 207 | |
| 208 | 208 | $tmpContent = $templateContent; |
| 209 | 209 | $tmpContent = str_replace('{CLASS_NAME}', $class, $tmpContent); |