@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function getHandlerFileNamesByNameAndActions(string $name, array $actions): array |
| 194 | 194 | { |
| 195 | - return array_map(function (string $action) use ($name) { |
|
| 195 | + return array_map(function(string $action) use ($name) { |
|
| 196 | 196 | return studly_case($action).studly_case($name).'.php'; |
| 197 | 197 | }, $actions); |
| 198 | 198 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | protected function getFileNamesByPath(string $path): array |
| 207 | 207 | { |
| 208 | - return array_map(function (SplFileInfo $file) { |
|
| 208 | + return array_map(function(SplFileInfo $file) { |
|
| 209 | 209 | return $file->getFilename(); |
| 210 | 210 | }, $this->files->files($path)); |
| 211 | 211 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | protected function makeDirectory(string $path): string |
| 48 | 48 | { |
| 49 | - if (! $this->files->isDirectory(dirname($path))) { |
|
| 49 | + if (!$this->files->isDirectory(dirname($path))) { |
|
| 50 | 50 | $this->files->makeDirectory(dirname($path), 0777, true, true); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $finalNamespace = $this->getFinalNamespace(); |
| 68 | 68 | |
| 69 | 69 | $this->getGeneratedClassNames() |
| 70 | - ->each(function (string $className) use ($finalNamespace) { |
|
| 70 | + ->each(function(string $className) use ($finalNamespace) { |
|
| 71 | 71 | $this->nameInput = $finalNamespace.'\\'.$className; |
| 72 | 72 | $this->type = $className.' handler'; |
| 73 | 73 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $defaultNamespace = $this->laravel->getNamespace().'Http\\Handlers'; |
| 88 | 88 | |
| 89 | - if (! is_null($namespaceOption = $this->getValidatedAndNormalizedNamespaceOption())) { |
|
| 89 | + if (!is_null($namespaceOption = $this->getValidatedAndNormalizedNamespaceOption())) { |
|
| 90 | 90 | if (starts_with($namespaceOption, '\\')) { |
| 91 | 91 | return $namespaceOption; |
| 92 | 92 | } |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $namespace = (string) $this->option('namespace'); |
| 108 | 108 | |
| 109 | - if (! $namespace) { |
|
| 109 | + if (!$namespace) { |
|
| 110 | 110 | return null; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $namespaceWithNormalizedSlashes = preg_replace('/[\/\\\]+/', '\\', $namespace); |
| 114 | 114 | |
| 115 | - if (! preg_match('/^(\\\|(\\\?\w+)+)$/', $namespaceWithNormalizedSlashes)) { |
|
| 115 | + if (!preg_match('/^(\\\|(\\\?\w+)+)$/', $namespaceWithNormalizedSlashes)) { |
|
| 116 | 116 | $this->error('['.$namespace.'] is not a valid namespace.'); |
| 117 | 117 | exit; |
| 118 | 118 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if ($this->actions->isEmpty()) { |
| 140 | 140 | return collect([$name]); |
| 141 | 141 | } else { |
| 142 | - return $this->actions->map(function (string $action) use ($name) { |
|
| 142 | + return $this->actions->map(function(string $action) use ($name) { |
|
| 143 | 143 | return studly_case($action).$name; |
| 144 | 144 | }); |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | protected function getValidatedNameArgument(): string |
| 154 | 154 | { |
| 155 | 155 | $name = (string) $this->argument('name'); |
| 156 | - if (! preg_match('/^\w+$/', $name)) { |
|
| 156 | + if (!preg_match('/^\w+$/', $name)) { |
|
| 157 | 157 | $this->error('Name can\'t contain any non-word characters.'); |
| 158 | 158 | exit; |
| 159 | 159 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | if ($this->option('resource')) { |
| 172 | 172 | collect(['index', 'show', 'create', 'store', 'edit', 'update', 'destroy']) |
| 173 | - ->each(function (string $resourceAction) { |
|
| 173 | + ->each(function(string $resourceAction) { |
|
| 174 | 174 | $this->addActionIfNotExists($resourceAction); |
| 175 | 175 | }); |
| 176 | 176 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | if ($actions = (string) $this->option('actions')) { |
| 189 | 189 | collect(explode(',', $actions)) |
| 190 | - ->each(function (string $action) { |
|
| 190 | + ->each(function(string $action) { |
|
| 191 | 191 | $this->addActionIfNotExists( |
| 192 | 192 | $this->getValidatedAndNormalizedActionName($action) |
| 193 | 193 | ); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | { |
| 207 | 207 | if ($except = (string) $this->option('except')) { |
| 208 | 208 | collect(explode(',', $except)) |
| 209 | - ->each(function (string $action) { |
|
| 209 | + ->each(function(string $action) { |
|
| 210 | 210 | $this->deleteActionIfExists( |
| 211 | 211 | $this->getValidatedAndNormalizedActionName($action) |
| 212 | 212 | ); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | if ($this->option('api')) { |
| 227 | 227 | collect(['edit', 'create']) |
| 228 | - ->each(function (string $action) { |
|
| 228 | + ->each(function(string $action) { |
|
| 229 | 229 | $this->deleteActionIfExists($action); |
| 230 | 230 | }); |
| 231 | 231 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function addActionIfNotExists(string $action): void |
| 243 | 243 | { |
| 244 | - if (! $this->actions->contains($action)) { |
|
| 244 | + if (!$this->actions->contains($action)) { |
|
| 245 | 245 | $this->actions->push($action); |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function deleteActionIfExists(string $action): void |
| 255 | 255 | { |
| 256 | - $this->actions = $this->actions->reject(function (string $existingAction) use ($action, &$exists) { |
|
| 256 | + $this->actions = $this->actions->reject(function(string $existingAction) use ($action, &$exists) { |
|
| 257 | 257 | return $existingAction === $action; |
| 258 | 258 | }); |
| 259 | 259 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | protected function getValidatedAndNormalizedActionName(string $action): string |
| 268 | 268 | { |
| 269 | - if (! preg_match('/^\w+$/', $action)) { |
|
| 269 | + if (!preg_match('/^\w+$/', $action)) { |
|
| 270 | 270 | $this->error('['.$action.'] is not a valid action name.'); |
| 271 | 271 | exit; |
| 272 | 272 | } |