@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if (str_contains($controllername, '@')) { |
24 | 24 | return ucfirst(preg_quote($controllername)); |
25 | 25 | } |
26 | - return ucfirst(preg_quote($controllername) . '@index'); |
|
26 | + return ucfirst(preg_quote($controllername).'@index'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | protected function controllerMethod($controllername) |
50 | 50 | { |
51 | 51 | if (str_contains($controller = $controllername, '@')) { |
52 | - return substr($controllername, strpos($controllername, '@')+1, strlen($controllername)); |
|
52 | + return substr($controllername, strpos($controllername, '@') + 1, strlen($controllername)); |
|
53 | 53 | } |
54 | 54 | return 'index'; |
55 | 55 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function getStubPath() |
34 | 34 | { |
35 | - return __DIR__ . '/../stubs/route_with_controller.stub'; |
|
35 | + return __DIR__.'/../stubs/route_with_controller.stub'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | protected function obtainReplacements() |
44 | 44 | { |
45 | 45 | return [ |
46 | - 'ROUTE_LINK' => $this->getReplacements()[0], |
|
47 | - 'ROUTE_CONTROLLER' => $this->controller($this->getReplacements()[1]), |
|
48 | - 'ROUTE_METHOD' => $this->getReplacements()[2], |
|
46 | + 'ROUTE_LINK' => $this->getReplacements()[ 0 ], |
|
47 | + 'ROUTE_CONTROLLER' => $this->controller($this->getReplacements()[ 1 ]), |
|
48 | + 'ROUTE_METHOD' => $this->getReplacements()[ 2 ], |
|
49 | 49 | ]; |
50 | 50 | } |
51 | 51 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $tmpfile = $this->createTmpFileWithRoute(); |
96 | 96 | $path = $this->getPath($tmpfile); |
97 | 97 | add_file_into_file($this->mountpoint(), $path, $dstFile = $this->destinationFile()); |
98 | - $this->info('Route ' . $link . ' added to ' . $dstFile . '.'); |
|
98 | + $this->info('Route '.$link.' added to '.$dstFile.'.'); |
|
99 | 99 | $this->postActions(); |
100 | 100 | } |
101 | 101 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $link = $this->removeTrailingSlashIfExists($link); |
166 | 166 | $link = $this->removeDuplicatedTrailingSlashes($link); |
167 | 167 | foreach (Route::getRoutes() as $value) { |
168 | - if (in_array(strtoupper($this->option('method')), array_merge($value->getMethods(), ['ANY'])) && $value->getPath() === $link) { |
|
168 | + if (in_array(strtoupper($this->option('method')), array_merge($value->getMethods(), [ 'ANY' ])) && $value->getPath() === $link) { |
|
169 | 169 | return true; |
170 | 170 | } |
171 | 171 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | protected function apiRouteExists($link) |
207 | 207 | { |
208 | - return $this->webRouteExists('api/v1/' . $link); |
|
208 | + return $this->webRouteExists('api/v1/'.$link); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function getPath($tmpfile) |
230 | 230 | { |
231 | - return stream_get_meta_data($tmpfile)['uri']; |
|
231 | + return stream_get_meta_data($tmpfile)[ 'uri' ]; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | protected function getRouteCode() |
240 | 240 | { |
241 | 241 | $type = $this->option('type'); |
242 | - $class = isset(static::$lookup[$type]) |
|
243 | - ? static::$lookup[$type] |
|
242 | + $class = isset(static::$lookup[ $type ]) |
|
243 | + ? static::$lookup[ $type ] |
|
244 | 244 | : RegularRoute::class; |
245 | 245 | /** @var GeneratesCode $route */ |
246 | 246 | $route = new $class($this->compiler, $this->filesystem); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | protected function validateMethod() |
294 | 294 | { |
295 | - if (! in_array(strtoupper($this->option('method')), $methods = array_merge(Router::$verbs, ['ANY']))) { |
|
295 | + if (!in_array(strtoupper($this->option('method')), $methods = array_merge(Router::$verbs, [ 'ANY' ]))) { |
|
296 | 296 | throw new MethodNotAllowedException($methods); |
297 | 297 | } |
298 | 298 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | protected function validateType() |
304 | 304 | { |
305 | - if (! in_array(strtolower($this->option('type')), ['regular','controller','resource'])) { |
|
305 | + if (!in_array(strtolower($this->option('type')), [ 'regular', 'controller', 'resource' ])) { |
|
306 | 306 | throw new RouteTypeNotValid(); |
307 | 307 | } |
308 | 308 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | Artisan::call('make:view', [ |
340 | 340 | 'name' => $this->action() |
341 | 341 | ]); |
342 | - $this->info('View ' . $this->action() .'.blade.php created.'); |
|
342 | + $this->info('View '.$this->action().'.blade.php created.'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | 'name' => $controller = $this->controllerWithoutMethod($this->action()) |
352 | 352 | ]); |
353 | 353 | $this->addMethodToController($controller, $this->controllerMethod($this->action())); |
354 | - $this->info('Controller ' . $controller .' created.'); |
|
354 | + $this->info('Controller '.$controller.' created.'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | 'name' => $controller = $this->controllerWithoutMethod($this->action()), |
364 | 364 | '--resource' => true |
365 | 365 | ]); |
366 | - $this->info('Resource Controller ' . $controller .' created.'); |
|
366 | + $this->info('Resource Controller '.$controller.' created.'); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | { |
377 | 377 | $tmpfile = $this->createTmpFileWithMethod($controllerMethod); |
378 | 378 | $path = $this->getPath($tmpfile); |
379 | - add_file_into_file('\/\/', $path, app_path('Http/Controllers/' . $controller . '.php')); |
|
379 | + add_file_into_file('\/\/', $path, app_path('Http/Controllers/'.$controller.'.php')); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -415,6 +415,6 @@ discard block |
||
415 | 415 | */ |
416 | 416 | protected function getMethodStubPath() |
417 | 417 | { |
418 | - return __DIR__ . '/stubs/method.stub'; |
|
418 | + return __DIR__.'/stubs/method.stub'; |
|
419 | 419 | } |
420 | 420 | } |