Completed
Push — master ( 73e470...c585f2 )
by Amine
01:49
created
src/Commands/ControllerCommand.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,6 @@
 block discarded – undo
1 1
 <?php namespace Wn\Generators\Commands;
2 2
 
3 3
 
4
-use InvalidArgumentException;
5
-
6 4
 class ControllerCommand extends BaseCommand {
7 5
 
8 6
 	protected $signature = 'wn:controller
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,33 +5,33 @@
 block discarded – undo
5 5
 
6 6
 class ControllerCommand extends BaseCommand {
7 7
 
8
-	protected $signature = 'wn:controller
8
+    protected $signature = 'wn:controller
9 9
         {model : Name of the model (with namespace if not App)}
10 10
 		{--no-routes= : without routes}
11 11
         {--force= : override the existing files}
12 12
         {--laravel : Use Laravel style route definitions}
13 13
     ';
14 14
 
15
-	protected $description = 'Generates RESTful controller using the RESTActions trait';
15
+    protected $description = 'Generates RESTful controller using the RESTActions trait';
16 16
 
17 17
     public function handle()
18 18
     {
19
-    	$model = $this->argument('model');
20
-    	$name = '';
21
-    	if(strrpos($model, "\\") === false){
22
-    		$name = $model;
23
-    		$model = "App\\" . $model;
24
-    	} else {
25
-    		$name = explode("\\", $model);
26
-    		$name = $name[count($name) - 1];
27
-    	}
19
+        $model = $this->argument('model');
20
+        $name = '';
21
+        if(strrpos($model, "\\") === false){
22
+            $name = $model;
23
+            $model = "App\\" . $model;
24
+        } else {
25
+            $name = explode("\\", $model);
26
+            $name = $name[count($name) - 1];
27
+        }
28 28
         $controller = ucwords(str_plural($name)) . 'Controller';
29 29
         $content = $this->getTemplate('controller')
30
-        	->with([
31
-        		'name' => $controller,
32
-        		'model' => $model
33
-        	])
34
-        	->get();
30
+            ->with([
31
+                'name' => $controller,
32
+                'model' => $model
33
+            ])
34
+            ->get();
35 35
 
36 36
         $this->save($content, "./app/Http/Controllers/{$controller}.php", "{$controller}");
37 37
         if(! $this->option('no-routes')){
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     {
19 19
     	$model = $this->argument('model');
20 20
     	$name = '';
21
-    	if(strrpos($model, "\\") === false){
21
+    	if (strrpos($model, "\\") === false) {
22 22
     		$name = $model;
23 23
     		$model = "App\\" . $model;
24 24
     	} else {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         	->get();
35 35
 
36 36
         $this->save($content, "./app/Http/Controllers/{$controller}.php", "{$controller}");
37
-        if(! $this->option('no-routes')){
37
+        if (!$this->option('no-routes')) {
38 38
             $options = [
39 39
                 'resource' => snake_case($name, '-'),
40 40
                 '--controller' => $controller,
Please login to merge, or discard this patch.
src/Commands/RouteCommand.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,6 @@
 block discarded – undo
1 1
 <?php namespace Wn\Generators\Commands;
2 2
 
3 3
 
4
-use InvalidArgumentException;
5
-
6 4
 class RouteCommand extends BaseCommand {
7 5
 
8 6
 	protected $signature = 'wn:route
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     protected function getController()
68 68
     {
69 69
         $controller = $this->option('controller');
70
-        if(! $controller){
70
+        if (!$controller) {
71 71
             $controller = ucwords(str_plural(camel_case($this->argument('resource')))) . 'Controller';
72 72
         }
73 73
         return $controller;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 
6 6
 class RouteCommand extends BaseCommand {
7 7
 
8
-	protected $signature = 'wn:route
8
+    protected $signature = 'wn:route
9 9
 		{resource : Name of the resource.}
10 10
         {--controller= : Name of the RESTful controller.}
11 11
         {--laravel= : Use Laravel style route definitions}
12 12
     ';
13 13
 
14
-	protected $description = 'Generates RESTful routes.';
14
+    protected $description = 'Generates RESTful routes.';
15 15
 
16 16
     public function handle()
17 17
     {
Please login to merge, or discard this patch.
lumen-test/tests/acceptance/RouteCommandCept.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
 
64 64
 $I->wantTo('run wn:routes in Lumen 5.3+');
65
-if(!file_exists('./routes')) {
65
+if (!file_exists('./routes')) {
66 66
     mkdir('./routes');
67 67
 }
68 68
 $I->writeToFile('./routes/web.php', '<?php
Please login to merge, or discard this patch.