| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | 'create:jobHandler', | 
| 24 | 24 | ]; | 
| 25 | 25 | |
| 26 | -        foreach ($strings as $string) { | |
| 26 | +        foreach ($strings as $string){ | |
| 27 | 27 | $this->assertStringContainsString($string, $result); | 
| 28 | 28 | } | 
| 29 | 29 | } | 
| @@ -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 | } | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | $class = $this->classify($name); | 
| 69 | 69 | $postfix = $this->elementPostfix($element); | 
| 70 | 70 | |
| 71 | - return \str_ends_with($class, $postfix) ? $class : $class . $postfix; | |
| 71 | + return \str_ends_with($class, $postfix) ? $class : $class.$postfix; | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | /** | 
| @@ -79,15 +79,15 @@ discard block | ||
| 79 | 79 | $localNamespace = \trim($this->getOption($element, 'namespace', ''), '\\'); | 
| 80 | 80 | ['namespace' => $namespace] = $this->parseName($name); | 
| 81 | 81 | |
| 82 | -        if (!empty($namespace)) { | |
| 83 | - $localNamespace .= '\\' . $this->classify($namespace); | |
| 82 | +        if (!empty($namespace)){ | |
| 83 | + $localNamespace .= '\\'.$this->classify($namespace); | |
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | -        if (empty($this->baseNamespace($element))) { | |
| 86 | +        if (empty($this->baseNamespace($element))){ | |
| 87 | 87 | return $localNamespace; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | - return \trim($this->baseNamespace($element) . '\\' . $localNamespace, '\\'); | |
| 90 | + return \trim($this->baseNamespace($element).'\\'.$localNamespace, '\\'); | |
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 | /** | 
| @@ -104,7 +104,7 @@ discard block | ||
| 104 | 104 | return $this->joinPathChunks([ | 
| 105 | 105 | $this->declarationDirectory($element), | 
| 106 | 106 |              \str_replace('\\', '/', $elementNamespace), | 
| 107 | - $this->className($element, $name) . '.php', | |
| 107 | + $this->className($element, $name).'.php', | |
| 108 | 108 | ], '/'); | 
| 109 | 109 | } | 
| 110 | 110 | |
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 |      { | 
| 118 | 118 | $class = $this->getOption($element, 'class'); | 
| 119 | 119 | |
| 120 | -        if (empty($class)) { | |
| 120 | +        if (empty($class)){ | |
| 121 | 121 | throw new ScaffolderException( | 
| 122 | 122 |                  \sprintf("Unable to scaffold '%s', no declaration class found", $element), | 
| 123 | 123 | ); | 
| @@ -165,11 +165,11 @@ discard block | ||
| 165 | 165 |      { | 
| 166 | 166 | $declaration = $this->getDeclaration($element); | 
| 167 | 167 | |
| 168 | -        if ($declaration === []) { | |
| 168 | +        if ($declaration === []){ | |
| 169 | 169 |              throw new ScaffolderException(\sprintf("Undefined declaration '%s'.", $element)); | 
| 170 | 170 | } | 
| 171 | 171 | |
| 172 | -        if (\array_key_exists($section, $declaration)) { | |
| 172 | +        if (\array_key_exists($section, $declaration)){ | |
| 173 | 173 | return $declaration[$section]; | 
| 174 | 174 | } | 
| 175 | 175 | |
| @@ -187,7 +187,7 @@ discard block | ||
| 187 | 187 |      { | 
| 188 | 188 |          $name = \str_replace('/', '\\', $name); | 
| 189 | 189 | |
| 190 | -        if (str_contains($name, '\\')) { | |
| 190 | +        if (str_contains($name, '\\')){ | |
| 191 | 191 |              $names = \explode('\\', $name); | 
| 192 | 192 | $class = \array_pop($names); | 
| 193 | 193 | |
| @@ -205,7 +205,7 @@ discard block | ||
| 205 | 205 |      { | 
| 206 | 206 | $declaration = $this->getDeclaration($element); | 
| 207 | 207 | |
| 208 | -        if (\array_key_exists('baseNamespace', $declaration)) { | |
| 208 | +        if (\array_key_exists('baseNamespace', $declaration)){ | |
| 209 | 209 | return \trim((string)$this->getOption($element, 'baseNamespace', ''), '\\'); | 
| 210 | 210 | } | 
| 211 | 211 | |
| @@ -216,12 +216,12 @@ discard block | ||
| 216 | 216 |      { | 
| 217 | 217 | $firstChunkIterated = false; | 
| 218 | 218 | $joinedPath = ''; | 
| 219 | -        foreach ($chunks as $chunk) { | |
| 220 | -            if (!$firstChunkIterated) { | |
| 219 | +        foreach ($chunks as $chunk){ | |
| 220 | +            if (!$firstChunkIterated){ | |
| 221 | 221 | $firstChunkIterated = true; | 
| 222 | 222 | $joinedPath = $chunk; | 
| 223 | -            } else { | |
| 224 | - $joinedPath = \rtrim($joinedPath, $joint) . $joint . \ltrim($chunk, $joint); | |
| 223 | +            }else{ | |
| 224 | + $joinedPath = \rtrim($joinedPath, $joint).$joint.\ltrim($chunk, $joint); | |
| 225 | 225 | } | 
| 226 | 226 | } | 
| 227 | 227 | |
| @@ -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,35 +32,35 @@ | ||
| 32 | 32 | $available = $config->getDeclarations(); | 
| 33 | 33 | |
| 34 | 34 | $i = 0; | 
| 35 | -        foreach ($available as $name) { | |
| 36 | - $command = 'create:' . $name; | |
| 35 | +        foreach ($available as $name){ | |
| 36 | + $command = 'create:'.$name; | |
| 37 | 37 | |
| 38 | -            if (!$console->getApplication()->has($command)) { | |
| 38 | +            if (!$console->getApplication()->has($command)){ | |
| 39 | 39 | continue; | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | $command = $console->getApplication()->get($command); | 
| 43 | 43 | |
| 44 | -            if ($i > 0) { | |
| 44 | +            if ($i > 0){ | |
| 45 | 45 | $table->addRow(new TableSeparator()); | 
| 46 | 46 | } | 
| 47 | 47 | $declaration = $config->getDeclaration($name); | 
| 48 | 48 | |
| 49 | 49 | $options = []; | 
| 50 | -            foreach ($declaration['options'] ?? [] as $key => $value) { | |
| 51 | - $options[] = $key . ': <fg=yellow>' . \json_encode(\str_replace($rootDir, '', $value)) . '</>'; | |
| 50 | +            foreach ($declaration['options'] ?? [] as $key => $value){ | |
| 51 | + $options[] = $key.': <fg=yellow>'.\json_encode(\str_replace($rootDir, '', $value)).'</>'; | |
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | $file = \str_replace($rootDir, '', $config->classFilename($name, $this->name)); | 
| 55 | 55 | $namespace = $config->classNamespace($name, $this->name); | 
| 56 | 56 | $table->addRow([ | 
| 57 | -                $command->getName() . "\n<fg=gray>{$command->getDescription()}</>", | |
| 57 | +                $command->getName()."\n<fg=gray>{$command->getDescription()}</>", | |
| 58 | 58 | <<<TARGET | 
| 59 | 59 | path: <fg=green>/$file</> | 
| 60 | 60 | namespace: <fg=yellow>$namespace</> | 
| 61 | 61 | TARGET | 
| 62 | 62 | . | 
| 63 | -                ($options !== [] ? "\n" . \implode("\n", $options) : ''), | |
| 63 | +                ($options !== [] ? "\n".\implode("\n", $options) : ''), | |
| 64 | 64 | ]); | 
| 65 | 65 | |
| 66 | 66 | $i++; | 
| @@ -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 | |
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 | <<<TARGET | 
| 59 | 59 | path: <fg=green>/$file</> | 
| 60 | 60 | namespace: <fg=yellow>$namespace</> | 
| 61 | -TARGET | |
| 61 | +target | |
| 62 | 62 | . | 
| 63 | 63 |                  ($options !== [] ? "\n" . \implode("\n", $options) : ''), | 
| 64 | 64 | ]); | 
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | public function __construct( | 
| 28 | 28 | private readonly ConfiguratorInterface $config, | 
| 29 | 29 | private readonly KernelInterface $kernel, | 
| 30 | -    ) { | |
| 30 | +    ){ | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | public function init(ConsoleBootloader $console, DirectoriesInterface $dir): void | 
| @@ -41,9 +41,9 @@ discard block | ||
| 41 | 41 | $console->addCommand(Command\MiddlewareCommand::class); | 
| 42 | 42 | $console->addCommand(Command\FilterCommand::class); | 
| 43 | 43 | |
| 44 | -        try { | |
| 44 | +        try{ | |
| 45 | 45 | $defaultNamespace = (new ReflectionClass($this->kernel))->getNamespaceName(); | 
| 46 | -        } catch (ReflectionException) { | |
| 46 | +        }catch (ReflectionException){ | |
| 47 | 47 | $defaultNamespace = ''; | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | * Base directory for generated classes, class will be automatically localed into sub directory | 
| 59 | 59 | * using given namespace. | 
| 60 | 60 | */ | 
| 61 | -            'directory' => $dir->get('app') . 'src/', | |
| 61 | +            'directory' => $dir->get('app').'src/', | |
| 62 | 62 | |
| 63 | 63 | /* | 
| 64 | 64 | * Default namespace to be applied for every generated class. By default uses Kernel namespace |