@@ -23,7 +23,8 @@ |
||
| 23 | 23 | 'create:jobHandler', |
| 24 | 24 | ]; |
| 25 | 25 | |
| 26 | - foreach ($strings as $string) { |
|
| 26 | + foreach ($strings as $string) |
|
| 27 | + { |
|
| 27 | 28 | $this->assertStringContainsString($string, $result); |
| 28 | 29 | } |
| 29 | 30 | } |
@@ -79,11 +79,13 @@ discard block |
||
| 79 | 79 | $localNamespace = \trim($this->getOption($element, 'namespace', ''), '\\'); |
| 80 | 80 | ['namespace' => $namespace] = $this->parseName($name); |
| 81 | 81 | |
| 82 | - if (!empty($namespace)) { |
|
| 82 | + if (!empty($namespace)) |
|
| 83 | + { |
|
| 83 | 84 | $localNamespace .= '\\' . $this->classify($namespace); |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | - if (empty($this->baseNamespace($element))) { |
|
| 87 | + if (empty($this->baseNamespace($element))) |
|
| 88 | + { |
|
| 87 | 89 | return $localNamespace; |
| 88 | 90 | } |
| 89 | 91 | |
@@ -117,7 +119,8 @@ discard block |
||
| 117 | 119 | { |
| 118 | 120 | $class = $this->getOption($element, 'class'); |
| 119 | 121 | |
| 120 | - if (empty($class)) { |
|
| 122 | + if (empty($class)) |
|
| 123 | + { |
|
| 121 | 124 | throw new ScaffolderException( |
| 122 | 125 | \sprintf("Unable to scaffold '%s', no declaration class found", $element), |
| 123 | 126 | ); |
@@ -165,11 +168,13 @@ discard block |
||
| 165 | 168 | { |
| 166 | 169 | $declaration = $this->getDeclaration($element); |
| 167 | 170 | |
| 168 | - if ($declaration === []) { |
|
| 171 | + if ($declaration === []) |
|
| 172 | + { |
|
| 169 | 173 | throw new ScaffolderException(\sprintf("Undefined declaration '%s'.", $element)); |
| 170 | 174 | } |
| 171 | 175 | |
| 172 | - if (\array_key_exists($section, $declaration)) { |
|
| 176 | + if (\array_key_exists($section, $declaration)) |
|
| 177 | + { |
|
| 173 | 178 | return $declaration[$section]; |
| 174 | 179 | } |
| 175 | 180 | |
@@ -187,7 +192,8 @@ discard block |
||
| 187 | 192 | { |
| 188 | 193 | $name = \str_replace('/', '\\', $name); |
| 189 | 194 | |
| 190 | - if (str_contains($name, '\\')) { |
|
| 195 | + if (str_contains($name, '\\')) |
|
| 196 | + { |
|
| 191 | 197 | $names = \explode('\\', $name); |
| 192 | 198 | $class = \array_pop($names); |
| 193 | 199 | |
@@ -205,7 +211,8 @@ discard block |
||
| 205 | 211 | { |
| 206 | 212 | $declaration = $this->getDeclaration($element); |
| 207 | 213 | |
| 208 | - if (\array_key_exists('baseNamespace', $declaration)) { |
|
| 214 | + if (\array_key_exists('baseNamespace', $declaration)) |
|
| 215 | + { |
|
| 209 | 216 | return \trim((string)$this->getOption($element, 'baseNamespace', ''), '\\'); |
| 210 | 217 | } |
| 211 | 218 | |
@@ -216,11 +223,15 @@ discard block |
||
| 216 | 223 | { |
| 217 | 224 | $firstChunkIterated = false; |
| 218 | 225 | $joinedPath = ''; |
| 219 | - foreach ($chunks as $chunk) { |
|
| 220 | - if (!$firstChunkIterated) { |
|
| 226 | + foreach ($chunks as $chunk) |
|
| 227 | + { |
|
| 228 | + if (!$firstChunkIterated) |
|
| 229 | + { |
|
| 221 | 230 | $firstChunkIterated = true; |
| 222 | 231 | $joinedPath = $chunk; |
| 223 | - } else { |
|
| 232 | + } |
|
| 233 | + else |
|
| 234 | + { |
|
| 224 | 235 | $joinedPath = \rtrim($joinedPath, $joint) . $joint . \ltrim($chunk, $joint); |
| 225 | 236 | } |
| 226 | 237 | } |
@@ -32,22 +32,26 @@ |
||
| 32 | 32 | $available = $config->getDeclarations(); |
| 33 | 33 | |
| 34 | 34 | $i = 0; |
| 35 | - foreach ($available as $name) { |
|
| 35 | + foreach ($available as $name) |
|
| 36 | + { |
|
| 36 | 37 | $command = 'create:' . $name; |
| 37 | 38 | |
| 38 | - if (!$console->getApplication()->has($command)) { |
|
| 39 | + if (!$console->getApplication()->has($command)) |
|
| 40 | + { |
|
| 39 | 41 | continue; |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | $command = $console->getApplication()->get($command); |
| 43 | 45 | |
| 44 | - if ($i > 0) { |
|
| 46 | + if ($i > 0) |
|
| 47 | + { |
|
| 45 | 48 | $table->addRow(new TableSeparator()); |
| 46 | 49 | } |
| 47 | 50 | $declaration = $config->getDeclaration($name); |
| 48 | 51 | |
| 49 | 52 | $options = []; |
| 50 | - foreach ($declaration['options'] ?? [] as $key => $value) { |
|
| 53 | + foreach ($declaration['options'] ?? [] as $key => $value) |
|
| 54 | + { |
|
| 51 | 55 | $options[] = $key . ': <fg=yellow>' . \json_encode(\str_replace($rootDir, '', $value)) . '</>'; |
| 52 | 56 | } |
| 53 | 57 | |