Completed
Pull Request — master (#11)
by alexfloppy
03:17
created
app/Console/Commands/MakeJsonApiDemoRemove.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@
 block discarded – undo
169 169
 
170 170
             if (file_exists(app_path('JsonApi'))) {
171 171
                 if(!@rmdir(app_path('JsonApi'))) {
172
-                     throw new \League\Flysystem\Exception('JsonApi directory is not empty!');
172
+                        throw new \League\Flysystem\Exception('JsonApi directory is not empty!');
173 173
                 };
174 174
             }
175 175
         } catch (\League\Flysystem\Exception $e) {
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     /**
93 93
      * Execute the console command.
94 94
      *
95
-     * @return mixed
95
+     * @return boolean|null
96 96
      */
97 97
     public function handle()
98 98
     {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             $this->setupTest();
130 130
         }
131 131
 
132
-        if($this->option('fake')) {
132
+        if ($this->option('fake')) {
133 133
             $this->info('JsonApi demo entities fake removed successfully.');
134 134
             return true;
135 135
         }
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
     protected function setupTest()
150 150
     {
151 151
         foreach ($this->migrations as $key => $value) {
152
-            $this->migrations[$key] = $value . $this->testPostfix;
152
+            $this->migrations[ $key ] = $value . $this->testPostfix;
153 153
         }
154 154
         foreach ($this->seeds as $key => $value) {
155
-            $this->seeds[$key] = $value . $this->testPostfix;
155
+            $this->seeds[ $key ] = $value . $this->testPostfix;
156 156
         }
157 157
         foreach ($this->controllers as $key => $value) {
158
-            $this->controllers[$key] = $value . $this->testPostfix;
158
+            $this->controllers[ $key ] = $value . $this->testPostfix;
159 159
         }
160 160
         foreach ($this->models as $key => $value) {
161
-            $this->models[$key] = $value . $this->testPostfix;
161
+            $this->models[ $key ] = $value . $this->testPostfix;
162 162
         }
163 163
         $this->jsonapiEntities = $this->jsonapiEntitiesTest;
164 164
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         foreach ($this->migrations as $key => $value) {
191 191
             $mask = database_path('migrations/*' . $value);
192
-            array_map( "unlink", glob( $mask ) );
192
+            array_map("unlink", glob($mask));
193 193
         }
194 194
     }
195 195
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             }
228 228
 
229 229
             if (file_exists(app_path('JsonApi'))) {
230
-                if(!@rmdir(app_path('JsonApi'))) {
230
+                if (!@rmdir(app_path('JsonApi'))) {
231 231
                      throw new \League\Flysystem\Exception('JsonApi directory is not empty!');
232 232
                 };
233 233
             }
Please login to merge, or discard this patch.
app/Console/Commands/MakeJsonApiDemo.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -4,9 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Illuminate\Console\Command;
6 6
 use org\bovigo\vfs\vfsStream;
7
-use Symfony\Component\Console\Input\InputInterface;
8
-use Symfony\Component\Console\Output\OutputInterface;
9
-
10 7
 use org\bovigo\vfs\vfsStreamDirectory;
11 8
 use org\bovigo\vfs\vfsStreamWrapper;
12 9
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * @var array
66 66
      */
67
-    protected $stubs = [];
67
+    protected $stubs = [ ];
68 68
 
69 69
     /**
70 70
      * Create a new command instance.
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
     protected function setupTest()
105 105
     {
106 106
         foreach ($this->migrations as $key => $value) {
107
-            $this->migrations[$key] = $value . $this->testPostfix;
107
+            $this->migrations[ $key ] = $value . $this->testPostfix;
108 108
         }
109 109
         foreach ($this->seeds as $key => $value) {
110
-            $this->seeds[$key] = $value . $this->testPostfix;
110
+            $this->seeds[ $key ] = $value . $this->testPostfix;
111 111
         }
112 112
         foreach ($this->controllers as $key => $value) {
113
-            $this->controllers[$key] = $value . $this->testPostfix;
113
+            $this->controllers[ $key ] = $value . $this->testPostfix;
114 114
         }
115 115
         foreach ($this->models as $key => $value) {
116
-            $this->models[$key] = $value . $this->testPostfix;
116
+            $this->models[ $key ] = $value . $this->testPostfix;
117 117
         }
118 118
     }
119 119
 
@@ -162,22 +162,22 @@  discard block
 block discarded – undo
162 162
     protected function exportControllers()
163 163
     {
164 164
         if ($this->option('fake')) {
165
-            $path = $this->stubs['controllers'];
165
+            $path = $this->stubs[ 'controllers' ];
166 166
             $baseDir = new vfsStreamDirectory('app');
167 167
             vfsStream::copyFromFileSystem($path, $baseDir);
168 168
             return true;
169 169
         }
170 170
 
171 171
         foreach ($this->controllers as $key => $value) {
172
-            if (file_exists(app_path('Http/Controllers/Api/v1/'.$value)) && ! $this->option('force')) {
173
-                if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) {
172
+            if (file_exists(app_path('Http/Controllers/Api/v1/' . $value)) && !$this->option('force')) {
173
+                if (!$this->confirm("The [{$value}] already exists. Do you want to replace it?")) {
174 174
                     continue;
175 175
                 }
176 176
             }
177 177
 
178 178
             copy(
179
-                base_path('stubs/Controllers/'.$key),
180
-                app_path('Http/Controllers/Api/v1/'.$value)
179
+                base_path('stubs/Controllers/' . $key),
180
+                app_path('Http/Controllers/Api/v1/' . $value)
181 181
             );
182 182
         }
183 183
     }
@@ -188,22 +188,22 @@  discard block
 block discarded – undo
188 188
     protected function exportModels()
189 189
     {
190 190
         if ($this->option('fake')) {
191
-            $path = $this->stubs['models'];
191
+            $path = $this->stubs[ 'models' ];
192 192
             $baseDir = new vfsStreamDirectory('app');
193 193
             vfsStream::copyFromFileSystem($path, $baseDir);
194 194
             return true;
195 195
         }
196 196
 
197 197
         foreach ($this->models as $key => $value) {
198
-            if (file_exists(app_path('Models/'.$value)) && ! $this->option('force')) {
199
-                if (! $this->confirm("The [{$value}] model already exists. Do you want to replace it?")) {
198
+            if (file_exists(app_path('Models/' . $value)) && !$this->option('force')) {
199
+                if (!$this->confirm("The [{$value}] model already exists. Do you want to replace it?")) {
200 200
                     continue;
201 201
                 }
202 202
             }
203 203
 
204 204
             copy(
205
-                base_path('stubs/Models/'.$key),
206
-                app_path('Models/'.$value)
205
+                base_path('stubs/Models/' . $key),
206
+                app_path('Models/' . $value)
207 207
             );
208 208
         }
209 209
     }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     protected function exportMigrations()
215 215
     {
216 216
         if ($this->option('fake')) {
217
-            $path = $this->stubs['migrations'];
217
+            $path = $this->stubs[ 'migrations' ];
218 218
             $baseDir = new vfsStreamDirectory('app');
219 219
             vfsStream::copyFromFileSystem($path, $baseDir);
220 220
             return true;
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 
223 223
         $counter = 0;
224 224
         foreach ($this->migrations as $key => $value) {
225
-            if (file_exists(database_path('migrations/'.$value)) && ! $this->option('force')) {
226
-                if (! $this->confirm("The [{$value}] migration already exists. Do you want to replace it?")) {
225
+            if (file_exists(database_path('migrations/' . $value)) && !$this->option('force')) {
226
+                if (!$this->confirm("The [{$value}] migration already exists. Do you want to replace it?")) {
227 227
                     continue;
228 228
                 }
229 229
             }
230 230
 
231 231
             copy(
232 232
                 base_path('stubs/migrations/' . $key),
233
-                database_path('migrations/'. date('Y_m_d_Hi') . '0' . $counter++ . '_' . $value)
233
+                database_path('migrations/' . date('Y_m_d_Hi') . '0' . $counter++ . '_' . $value)
234 234
             );
235 235
         }
236 236
     }
@@ -241,22 +241,22 @@  discard block
 block discarded – undo
241 241
     protected function exportSeeds()
242 242
     {
243 243
         if ($this->option('fake')) {
244
-            $path = $this->stubs['seeds'];
244
+            $path = $this->stubs[ 'seeds' ];
245 245
             $baseDir = new vfsStreamDirectory('app');
246 246
             vfsStream::copyFromFileSystem($path, $baseDir);
247 247
             return true;
248 248
         }
249 249
 
250 250
         foreach ($this->seeds as $key => $value) {
251
-            if (file_exists(database_path('seeds/'.$value)) && ! $this->option('force')) {
252
-                if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) {
251
+            if (file_exists(database_path('seeds/' . $value)) && !$this->option('force')) {
252
+                if (!$this->confirm("The [{$value}] already exists. Do you want to replace it?")) {
253 253
                     continue;
254 254
                 }
255 255
             }
256 256
 
257 257
             copy(
258
-                base_path('stubs/seeds/'.$key),
259
-                database_path('seeds/'.$value)
258
+                base_path('stubs/seeds/' . $key),
259
+                database_path('seeds/' . $value)
260 260
             );
261 261
         }
262 262
     }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @param $src
266 266
      * @param $dst
267 267
      */
268
-    protected function recurse_copy($src,$dst)
268
+    protected function recurse_copy($src, $dst)
269 269
     {
270 270
         $dir = opendir($src);
271 271
         @mkdir($dst);
Please login to merge, or discard this patch.