@@ -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 | */ |
@@ -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 | /** |
@@ -36,8 +36,8 @@ |
||
| 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; |
@@ -118,10 +118,10 @@ |
||
| 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 | } |
@@ -98,9 +98,9 @@ |
||
| 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,11 +133,11 @@ 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 | |
| 140 | - $inOut->writeInfo("Found command class `$commandClass`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
| 140 | + $inOut->writeInfo("Found command class `$commandClass`.".PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
| 141 | 141 | |
| 142 | 142 | $commandClasses[] = $this->commandClassToArray($commandClass); |
| 143 | 143 | } |
@@ -156,19 +156,19 @@ discard block |
||
| 156 | 156 | EOT; |
| 157 | 157 | $cacheFilePath = $this->getCommandsCacheFilePath($this->getComposer()); |
| 158 | 158 | if (empty($cacheFilePath) === true) { |
| 159 | - $inOut->writeError("Commands cache file path is not set. Check your `Application` settings." . PHP_EOL); |
|
| 159 | + $inOut->writeError("Commands cache file path is not set. Check your `Application` settings.".PHP_EOL); |
|
| 160 | 160 | |
| 161 | 161 | return; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $this->getFileSystem($container)->write($cacheFilePath, $content); |
| 165 | 165 | |
| 166 | - $inOut->writeInfo('Commands connected.' . PHP_EOL); |
|
| 166 | + $inOut->writeInfo('Commands connected.'.PHP_EOL); |
|
| 167 | 167 | |
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $inOut->writeWarning('No commands found.' . PHP_EOL); |
|
| 171 | + $inOut->writeWarning('No commands found.'.PHP_EOL); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | $argClass = static::ARG_CLASS; |
| 183 | 183 | if ($inOut->hasArgument($argClass) === false) { |
| 184 | - $inOut->writeError("Argument `$argClass` is not provided." . PHP_EOL); |
|
| 184 | + $inOut->writeError("Argument `$argClass` is not provided.".PHP_EOL); |
|
| 185 | 185 | |
| 186 | 186 | return; |
| 187 | 187 | } |
@@ -191,19 +191,19 @@ discard block |
||
| 191 | 191 | $commandsFolder = $this->getCommandsFolder($container); |
| 192 | 192 | if (empty($commandsFolder) === true || $fileSystem->isFolder($commandsFolder) === false) { |
| 193 | 193 | $inOut->writeError( |
| 194 | - "Commands folder `$commandsFolder` is not valid. Check your `Application` settings." . PHP_EOL |
|
| 194 | + "Commands folder `$commandsFolder` is not valid. Check your `Application` settings.".PHP_EOL |
|
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $classPath = $commandsFolder . DIRECTORY_SEPARATOR . $class . '.php'; |
|
| 200 | + $classPath = $commandsFolder.DIRECTORY_SEPARATOR.$class.'.php'; |
|
| 201 | 201 | if (ctype_alpha($class) === false || |
| 202 | 202 | $fileSystem->exists($classPath) === true |
| 203 | 203 | ) { |
| 204 | 204 | $inOut->writeError( |
| 205 | - "Class name `$class` does not look valid for a command. " . |
|
| 206 | - 'Can you please choose another one?' . PHP_EOL |
|
| 205 | + "Class name `$class` does not look valid for a command. ". |
|
| 206 | + 'Can you please choose another one?'.PHP_EOL |
|
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | 209 | return; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | $commandName = strtolower($class); |
| 213 | 213 | |
| 214 | - $templateContent = $fileSystem->read(__DIR__ . DIRECTORY_SEPARATOR . 'SampleCommand.txt'); |
|
| 214 | + $templateContent = $fileSystem->read(__DIR__.DIRECTORY_SEPARATOR.'SampleCommand.txt'); |
|
| 215 | 215 | |
| 216 | 216 | $tmpContent = $templateContent; |
| 217 | 217 | $tmpContent = str_replace('{CLASS_NAME}', $class, $tmpContent); |