@@ -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 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $this->assertDirectoryNotExists($this->app->path('Handlers')); |
| 46 | 46 | |
| 47 | - $this->assertEquals(Artisan::output(), 'Name can\'t contain any non-word characters.' . PHP_EOL); |
|
| 47 | + $this->assertEquals(Artisan::output(), 'Name can\'t contain any non-word characters.'.PHP_EOL); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function test_create_existent_handler_without_force_option() |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $this->assertEquals($initialHandlerContent, file_get_contents($filePath)); |
| 64 | 64 | |
| 65 | - $this->assertEquals(Artisan::output(), 'ShowProfile handler already exists!' . PHP_EOL); |
|
| 65 | + $this->assertEquals(Artisan::output(), 'ShowProfile handler already exists!'.PHP_EOL); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function test_create_existent_handler_with_force_option() |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $this->assertDirectoryNotExists($this->app->path('Handlers')); |
| 118 | 118 | |
| 119 | - $this->assertEquals(Artisan::output(), '[InvalidNamespace%] is not a valid namespace.' . PHP_EOL); |
|
| 119 | + $this->assertEquals(Artisan::output(), '[InvalidNamespace%] is not a valid namespace.'.PHP_EOL); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function test_resource_option() |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $this->assertDirectoryNotExists($this->app->path('Handlers')); |
| 188 | 188 | |
| 189 | - $this->assertEquals(Artisan::output(), '[destroy%] is not a valid action name.' . PHP_EOL); |
|
| 189 | + $this->assertEquals(Artisan::output(), '[destroy%] is not a valid action name.'.PHP_EOL); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function test_except_option() |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | $this->assertDirectoryNotExists($this->app->path('Handlers')); |
| 223 | 223 | |
| 224 | - $this->assertEquals(Artisan::output(), '[destroy%] is not a valid action name.' . PHP_EOL); |
|
| 224 | + $this->assertEquals(Artisan::output(), '[destroy%] is not a valid action name.'.PHP_EOL); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function test_proper_file_content_generation() |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | protected function getHandlerFileNamesByNameAndActions(string $name, array $actions): array |
| 263 | 263 | { |
| 264 | - return array_map(function (string $action) use ($name) { |
|
| 264 | + return array_map(function(string $action) use ($name) { |
|
| 265 | 265 | return studly_case($action).studly_case($name).'.php'; |
| 266 | 266 | }, $actions); |
| 267 | 267 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | protected function getFileNamesByPath(string $path): array |
| 276 | 276 | { |
| 277 | - return array_map(function (SplFileInfo $file) { |
|
| 277 | + return array_map(function(SplFileInfo $file) { |
|
| 278 | 278 | return $file->getFilename(); |
| 279 | 279 | }, $this->files->files($path)); |
| 280 | 280 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function addIfNotExists(string $action): self |
| 31 | 31 | { |
| 32 | - if (! $this->actions->contains($action)) { |
|
| 32 | + if (!$this->actions->contains($action)) { |
|
| 33 | 33 | $this->actions->push($action); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function deleteIfExists(string $action): self |
| 46 | 46 | { |
| 47 | - $this->actions = $this->actions->reject(function (string $existingAction) use ($action) { |
|
| 47 | + $this->actions = $this->actions->reject(function(string $existingAction) use ($action) { |
|
| 48 | 48 | return $existingAction === $action; |
| 49 | 49 | }); |
| 50 | 50 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $bag = new ActionsBag; |
| 59 | 59 | |
| 60 | - if (! $this->processResourceOption($bag) || |
|
| 61 | - ! $this->processActionsOption($bag) || |
|
| 62 | - ! $this->processExceptOption($bag) || |
|
| 63 | - ! $this->processApiOption($bag)) { |
|
| 60 | + if (!$this->processResourceOption($bag) || |
|
| 61 | + !$this->processActionsOption($bag) || |
|
| 62 | + !$this->processExceptOption($bag) || |
|
| 63 | + !$this->processApiOption($bag)) { |
|
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | foreach ($classNames as $className) { |
| 79 | - $this->nameInput = $finalNamespace . '\\' . $className; |
|
| 80 | - $this->type = $className . ' handler'; |
|
| 79 | + $this->nameInput = $finalNamespace.'\\'.$className; |
|
| 80 | + $this->type = $className.' handler'; |
|
| 81 | 81 | |
| 82 | 82 | parent::handle(); |
| 83 | 83 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | if (($namespaceOption = $this->getValidatedAndNormalizedNamespaceOption()) === false) { |
| 98 | 98 | return false; |
| 99 | - } elseif (! is_null($namespaceOption)) { |
|
| 99 | + } elseif (!is_null($namespaceOption)) { |
|
| 100 | 100 | if (starts_with($namespaceOption, '\\')) { |
| 101 | 101 | return $namespaceOption; |
| 102 | 102 | } |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $namespace = (string) $this->option('namespace'); |
| 118 | 118 | |
| 119 | - if (! $namespace) { |
|
| 119 | + if (!$namespace) { |
|
| 120 | 120 | return null; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $namespaceWithNormalizedSlashes = preg_replace('/[\/\\\]+/', '\\', $namespace); |
| 124 | 124 | |
| 125 | - if (! preg_match('/^(\\\|(\\\?\w+)+)$/', $namespaceWithNormalizedSlashes)) { |
|
| 125 | + if (!preg_match('/^(\\\|(\\\?\w+)+)$/', $namespaceWithNormalizedSlashes)) { |
|
| 126 | 126 | $this->error('['.$namespace.'] is not a valid namespace.'); |
| 127 | 127 | |
| 128 | 128 | return false; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | if ($bag->isEmpty()) { |
| 146 | 146 | return [$name]; |
| 147 | 147 | } else { |
| 148 | - return array_map(function (string $action) use ($name) { |
|
| 148 | + return array_map(function(string $action) use ($name) { |
|
| 149 | 149 | return studly_case($action).$name; |
| 150 | 150 | }, $bag->get()); |
| 151 | 151 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | protected function getValidatedNameArgument() |
| 160 | 160 | { |
| 161 | 161 | $name = (string) $this->argument('name'); |
| 162 | - if (! preg_match('/^\w+$/', $name)) { |
|
| 162 | + if (!preg_match('/^\w+$/', $name)) { |
|
| 163 | 163 | $this->error('Name can\'t contain any non-word characters.'); |
| 164 | 164 | |
| 165 | 165 | return false; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | return $base; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - $this->error('The [' . $base . '] class specified as the base handler doesn\'t exist.'); |
|
| 300 | + $this->error('The ['.$base.'] class specified as the base handler doesn\'t exist.'); |
|
| 301 | 301 | |
| 302 | 302 | return false; |
| 303 | 303 | } |