@@ -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 | */ |
@@ -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 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $connect = static::ACTION_CONNECT; |
82 | 82 | $create = static::ACTION_CREATE; |
83 | - $actionDesc = "Required action such as `$connect` to find and connect commands from application and plugins " . |
|
83 | + $actionDesc = "Required action such as `$connect` to find and connect commands from application and plugins ". |
|
84 | 84 | "or `$create` to create an empty command template."; |
85 | 85 | |
86 | 86 | $classDesc = "Required valid class name in commands' namespace for action `$create`."; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->executeCreate($container, $inOut); |
114 | 114 | break; |
115 | 115 | default: |
116 | - $inOut->writeError("Unknown value `$action` for argument `$argAction`." . PHP_EOL); |
|
116 | + $inOut->writeError("Unknown value `$action` for argument `$argAction`.".PHP_EOL); |
|
117 | 117 | break; |
118 | 118 | } |
119 | 119 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | if (class_exists($commandClass) === false || |
139 | 139 | array_key_exists(CommandInterface::class, class_implements($commandClass)) === false |
140 | 140 | ) { |
141 | - $inOut->writeWarning("Class `$commandClass` either do not exist or not a command class." . PHP_EOL); |
|
141 | + $inOut->writeWarning("Class `$commandClass` either do not exist or not a command class.".PHP_EOL); |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
145 | - $inOut->writeInfo("Found command class `$commandClass`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
145 | + $inOut->writeInfo("Found command class `$commandClass`.".PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
146 | 146 | |
147 | 147 | $commandClasses[] = $this->commandClassToArray($commandClass); |
148 | 148 | } |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | EOT; |
162 | 162 | $cacheFilePath = $this->getCommandsCacheFilePath($this->getComposer()); |
163 | 163 | if (empty($cacheFilePath) === true) { |
164 | - $inOut->writeError("Commands cache file path is not set. Check your `Application` settings." . PHP_EOL); |
|
164 | + $inOut->writeError("Commands cache file path is not set. Check your `Application` settings.".PHP_EOL); |
|
165 | 165 | |
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | 169 | $this->getFileSystem($container)->write($cacheFilePath, $content); |
170 | 170 | |
171 | - $inOut->writeInfo('Commands connected.' . PHP_EOL); |
|
171 | + $inOut->writeInfo('Commands connected.'.PHP_EOL); |
|
172 | 172 | |
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - $inOut->writeWarning('No commands found.' . PHP_EOL); |
|
176 | + $inOut->writeWarning('No commands found.'.PHP_EOL); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | $argClass = static::ARG_CLASS; |
191 | 191 | if ($inOut->hasArgument($argClass) === false) { |
192 | - $inOut->writeError("Argument `$argClass` is not provided." . PHP_EOL); |
|
192 | + $inOut->writeError("Argument `$argClass` is not provided.".PHP_EOL); |
|
193 | 193 | |
194 | 194 | return; |
195 | 195 | } |
@@ -199,25 +199,25 @@ discard block |
||
199 | 199 | $commandsFolder = $this->getCommandsFolder($container); |
200 | 200 | if (empty($commandsFolder) === true || $fileSystem->isFolder($commandsFolder) === false) { |
201 | 201 | $inOut->writeError( |
202 | - "Commands folder `$commandsFolder` is not valid. Check your `Application` settings." . PHP_EOL |
|
202 | + "Commands folder `$commandsFolder` is not valid. Check your `Application` settings.".PHP_EOL |
|
203 | 203 | ); |
204 | 204 | |
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
208 | - $classPath = $commandsFolder . DIRECTORY_SEPARATOR . $class . '.php'; |
|
208 | + $classPath = $commandsFolder.DIRECTORY_SEPARATOR.$class.'.php'; |
|
209 | 209 | if (ctype_alpha($class) === false || |
210 | 210 | $fileSystem->exists($classPath) === true |
211 | 211 | ) { |
212 | 212 | $inOut->writeError( |
213 | - "Class name `$class` does not look valid for a command. " . |
|
214 | - 'Can you please choose another one?' . PHP_EOL |
|
213 | + "Class name `$class` does not look valid for a command. ". |
|
214 | + 'Can you please choose another one?'.PHP_EOL |
|
215 | 215 | ); |
216 | 216 | |
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | - $replace = function (string $template, iterable $parameters): string { |
|
220 | + $replace = function(string $template, iterable $parameters): string { |
|
221 | 221 | $result = $template; |
222 | 222 | foreach ($parameters as $key => $value) { |
223 | 223 | $result = str_replace($key, $value, $result); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return $result; |
227 | 227 | }; |
228 | 228 | |
229 | - $templateContent = $fileSystem->read(__DIR__ . DIRECTORY_SEPARATOR . 'SampleCommand.txt'); |
|
229 | + $templateContent = $fileSystem->read(__DIR__.DIRECTORY_SEPARATOR.'SampleCommand.txt'); |
|
230 | 230 | $fileSystem->write($classPath, $replace($templateContent, [ |
231 | 231 | '{CLASS_NAME}' => $class, |
232 | 232 | '{COMMAND_NAME}' => strtolower($class), |
@@ -83,7 +83,7 @@ |
||
83 | 83 | */ |
84 | 84 | protected function getAutoloadPath(Composer $composer): string |
85 | 85 | { |
86 | - return $composer->getConfig()->get('vendor-dir') . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
86 | + return $composer->getConfig()->get('vendor-dir').DIRECTORY_SEPARATOR.'autoload.php'; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | unset($containerClone); |
84 | 84 | |
85 | - $routesPath = $routesFolder . DIRECTORY_SEPARATOR . $routesMask; |
|
85 | + $routesPath = $routesFolder.DIRECTORY_SEPARATOR.$routesMask; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | [$configurators, $middleware] |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | callable $command, |
274 | 274 | PsrContainerInterface $container |
275 | 275 | ): Closure { |
276 | - $next = function (IoInterface $inOut) use ($command, $container): void { |
|
276 | + $next = function(IoInterface $inOut) use ($command, $container): void { |
|
277 | 277 | call_user_func($command, $container, $inOut); |
278 | 278 | }; |
279 | 279 | |
280 | 280 | for ($index = count($middleware) - 1; $index >= 0; $index--) { |
281 | 281 | $currentMiddleware = $middleware[$index]; |
282 | - $next = function (IoInterface $inOut) use ($currentMiddleware, $next, $container): void { |
|
282 | + $next = function(IoInterface $inOut) use ($currentMiddleware, $next, $container): void { |
|
283 | 283 | call_user_func($currentMiddleware, $inOut, $next, $container); |
284 | 284 | }; |
285 | 285 | } |
@@ -139,14 +139,14 @@ |
||
139 | 139 | $handler = $container->get(ThrowableHandlerInterface::class); |
140 | 140 | $response = $handler->createResponse($exception, $container); |
141 | 141 | |
142 | - $output->writeln((string)$response->getBody()); |
|
142 | + $output->writeln((string) $response->getBody()); |
|
143 | 143 | } else { |
144 | 144 | $message = $exception->getMessage(); |
145 | 145 | $file = $exception->getFile(); |
146 | 146 | $line = $exception->getLine(); |
147 | 147 | $trace = $exception->getTraceAsString(); |
148 | 148 | |
149 | - $output->writeln("$message at $file#$line" . PHP_EOL . $trace); |
|
149 | + $output->writeln("$message at $file#$line".PHP_EOL.$trace); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | throw $exception; |