Completed
Pull Request — master (#40)
by
unknown
01:37
created
lumen-test/database/factories/ModelFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 |
12 12
 */
13 13
 
14
-$factory->define(App\User::class, function ($faker) {
14
+$factory->define(App\User::class, function($faker) {
15 15
     return [
16 16
         'name' => $faker->name,
17 17
         'email' => $faker->email,
Please login to merge, or discard this patch.
lumen-test/app/Http/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
 |
12 12
 */
13 13
 
14
-$app->get("/", function () use ($app) {
14
+$app->get("/", function() use ($app) {
15 15
     return $app->welcome();
16 16
 });
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.
src/Commands/RouteCommand.php 1 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.
src/Commands/ResourceCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         ]);
62 62
 
63 63
         // generating REST actions trait if doesn't exist
64
-        if(! $this->fs->exists('./app/Http/Controllers/RESTActions.php')){
64
+        if (!$this->fs->exists('./app/Http/Controllers/RESTActions.php')) {
65 65
             $this->call('wn:controller:rest-actions');
66 66
         }
67 67
         // generating the controller and routes
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
     protected function parseFields()
94 94
     {
95 95
         $fields = $this->argument('fields');
96
-        if($this->option('parsed')){
96
+        if ($this->option('parsed')) {
97 97
             $this->fields = $fields;
98 98
         } else {
99
-            if(! $fields){
99
+            if (!$fields) {
100 100
                 $this->fields = [];
101 101
             } else {
102 102
                 $this->fields = $this->getArgumentParser('fields')
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
     protected function fieldsHavingTag($tag)
122 122
     {
123
-        return array_map(function($field){
123
+        return array_map(function($field) {
124 124
             return $field['name'];
125 125
         }, array_filter($this->fields, function($field) use($tag){
126 126
             return in_array($tag, $field['tags']);
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 
130 130
     protected function rules()
131 131
     {
132
-        return array_map(function($field){
132
+        return array_map(function($field) {
133 133
             return [
134 134
                 'name' => $field['name'],
135 135
                 'rule' => $field['rules']
136 136
             ];
137
-        }, array_filter($this->fields, function($field){
137
+        }, array_filter($this->fields, function($field) {
138 138
             return !empty($field['rules']);
139 139
         }));
140 140
     }
141 141
 
142 142
     protected function schema()
143 143
     {
144
-        return array_map(function($field){
144
+        return array_map(function($field) {
145 145
             return array_merge([[
146 146
                 'name' => $field['name'],
147 147
                 'args' => []
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
     protected function foreignKeys()
153 153
     {
154 154
         $belongsTo = $this->option('belongs-to');
155
-        if(! $belongsTo) {
155
+        if (!$belongsTo) {
156 156
             return [];
157 157
         }
158 158
         $relations = $this->getArgumentParser('relations')->parse($belongsTo);
159
-        return array_map(function($relation){
159
+        return array_map(function($relation) {
160 160
             $name = $relation['model'] ? $relation['model'] : $relation['name'];
161 161
             $index = strrpos($name, "\\");
162
-            if($index) {
162
+            if ($index) {
163 163
                 $name = substr($name, $index + 1);
164 164
             }
165 165
             return snake_case(str_singular($name)) . '_id';
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 
181 181
     protected function factoryFields()
182 182
     {
183
-        return array_map(function($field){
183
+        return array_map(function($field) {
184 184
             return [
185 185
                 'name' => $field['name'],
186 186
                 'type' => $field['factory']
187 187
             ];
188
-        }, array_filter($this->fields, function($field){
188
+        }, array_filter($this->fields, function($field) {
189 189
             return isset($field['factory']) && $field['factory'];
190 190
         }));
191 191
     }
Please login to merge, or discard this patch.
src/Commands/ControllerCommand.php 1 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/ResourcesCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         $content = $this->fs->get($this->argument('file'));
24 24
         $content = Yaml::parse($content);
25 25
 
26
-        foreach ($content as $model => $i){
26
+        foreach ($content as $model => $i) {
27 27
             $i = $this->getResourceParams($model, $i);
28 28
 
29 29
             $options = [
@@ -72,34 +72,34 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $i['name'] = snake_case($modelName);
74 74
 
75
-        foreach(['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation){
76
-            if(isset($i[$relation])){
75
+        foreach (['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation) {
76
+            if (isset($i[$relation])) {
77 77
                 $i[$relation] = $this->convertArray($i[$relation], ' ', ',');
78 78
             } else {
79 79
                 $i[$relation] = false;
80 80
             }
81 81
         }
82 82
 
83
-        if($i['belongsToMany']){
83
+        if ($i['belongsToMany']) {
84 84
             $relations = $this->getArgumentParser('relations')->parse($i['belongsToMany']);
85
-            foreach ($relations as $relation){
85
+            foreach ($relations as $relation) {
86 86
                 $table = '';
87 87
 
88
-                if(! $relation['model']){
88
+                if (!$relation['model']) {
89 89
                     $table = snake_case($relation['name']);
90 90
                 } else {
91 91
                     $names = array_reverse(explode("\\", $relation['model']));
92 92
                     $table = snake_case($names[0]);
93 93
                 }
94 94
 
95
-                $tables = [ str_singular($table), $i['name'] ];
95
+                $tables = [str_singular($table), $i['name']];
96 96
                 sort($tables);
97 97
                 $this->pivotTables[] = $tables;
98 98
             }
99 99
         }
100 100
 
101 101
         $fields = [];
102
-        foreach($i['fields'] as $name => $value) {
102
+        foreach ($i['fields'] as $name => $value) {
103 103
             $value['name'] = $name;
104 104
             $fields[] = $this->serializeField($value);
105 105
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         $string = "{$name};{$schema};{$rules};{$tags}";
122 122
 
123
-        if(isset($field['factory']) && !empty($field['factory'])){
123
+        if (isset($field['factory']) && !empty($field['factory'])) {
124 124
             $string .= ';' . $field['factory'];
125 125
         }
126 126
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
     protected function convertArray($list, $old, $new)
131 131
     {
132
-        return implode($new, array_filter(explode($old, $list), function($item){
132
+        return implode($new, array_filter(explode($old, $list), function($item) {
133 133
             return !empty($item);
134 134
         }));
135 135
     }
Please login to merge, or discard this patch.