Passed
Push — master ( 8a373e...617e52 )
by Arthur
22:06
created
src/Foundation/Generator/Abstracts/AbstractGeneratorCommand.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @var array
57 57
      */
58
-    protected $optionData = [];
58
+    protected $optionData = [ ];
59 59
 
60 60
     /**
61 61
      * The data that is inputted from the arguments.
62 62
      *
63 63
      * @var array
64 64
      */
65
-    protected $argumentData = [];
65
+    protected $argumentData = [ ];
66 66
 
67 67
     public function handle()
68 68
     {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $this->beforeGeneration();
82 82
 
83 83
         if ($this->event === null)
84
-            throw new Exception("No Generator event specified on " . static::class);
84
+            throw new Exception("No Generator event specified on ".static::class);
85 85
 
86 86
         event(new $this->event($path, $stub));
87 87
         $this->info("Created : {$path}");
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected function getDestinationFilePath(): string
101 101
     {
102
-        return $this->getModule()->getPath() . $this->filePath . '/' . $this->getFileName();
102
+        return $this->getModule()->getPath().$this->filePath.'/'.$this->getFileName();
103 103
     }
104 104
 
105 105
     /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     final protected function getOptions()
146 146
     {
147 147
         $options = $this->setOptions();
148
-        $options[] = ['overwrite', null, InputOption::VALUE_NONE, 'Overwrite this file if it already exists?'];
148
+        $options[ ] = [ 'overwrite', null, InputOption::VALUE_NONE, 'Overwrite this file if it already exists?' ];
149 149
         return $options;
150 150
     }
151 151
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     final protected function getArguments()
158 158
     {
159 159
         return array_merge([
160
-            ['module', InputArgument::OPTIONAL, 'The name of module will be used.'],
160
+            [ 'module', InputArgument::OPTIONAL, 'The name of module will be used.' ],
161 161
         ],
162 162
             $this->setArguments());
163 163
     }
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
     protected function handleOptions()
195 195
     {
196 196
         foreach ($this->getOptions() as $option) {
197
-            $method = 'handle' . ucfirst(strtolower($option[0])) . 'Option';
197
+            $method = 'handle'.ucfirst(strtolower($option[ 0 ])).'Option';
198 198
             $originalInput = $this->getOriginalOptionInput();
199
-            if (isset($originalInput[$option[0]])) {
200
-                $this->optionData[$option[0]] = $originalInput[$option[0]];
199
+            if (isset($originalInput[ $option[ 0 ] ])) {
200
+                $this->optionData[ $option[ 0 ] ] = $originalInput[ $option[ 0 ] ];
201 201
             } else {
202
-                $this->optionData[$option[0]] = method_exists($this, $method) ? $this->$method($option[1], $option[2], $option[3], $option[4] ?? null) : $this->option($option[0]);
202
+                $this->optionData[ $option[ 0 ] ] = method_exists($this, $method) ? $this->$method($option[ 1 ], $option[ 2 ], $option[ 3 ], $option[ 4 ] ?? null) : $this->option($option[ 0 ]);
203 203
             }
204 204
         }
205 205
     }
206 206
 
207 207
     protected function handleModuleArgument()
208 208
     {
209
-        return $this->anticipate('For what module would you like to generate a ' . $this->getGeneratorName() . '.', Larapi::getModuleNames());
209
+        return $this->anticipate('For what module would you like to generate a '.$this->getGeneratorName().'.', Larapi::getModuleNames());
210 210
     }
211 211
 
212 212
     protected function getModuleName()
@@ -222,24 +222,24 @@  discard block
 block discarded – undo
222 222
     protected function handleArguments()
223 223
     {
224 224
         foreach ($this->getArguments() as $argument) {
225
-            $method = 'handle' . ucfirst(strtolower($argument[0])) . 'Argument';
225
+            $method = 'handle'.ucfirst(strtolower($argument[ 0 ])).'Argument';
226 226
             $originalInput = $this->getOriginalArgumentInput();
227
-            if (isset($originalInput[$argument[0]])) {
228
-                $this->argumentData[$argument[0]] = $originalInput[$argument[0]];
227
+            if (isset($originalInput[ $argument[ 0 ] ])) {
228
+                $this->argumentData[ $argument[ 0 ] ] = $originalInput[ $argument[ 0 ] ];
229 229
             } else {
230
-                $this->argumentData[$argument[0]] = method_exists($this, $method) ? $this->$method($argument[1], $argument[2], $argument[3] ?? null) : $this->option($argument[0]);
230
+                $this->argumentData[ $argument[ 0 ] ] = method_exists($this, $method) ? $this->$method($argument[ 1 ], $argument[ 2 ], $argument[ 3 ] ?? null) : $this->option($argument[ 0 ]);
231 231
             }
232 232
         }
233 233
     }
234 234
 
235 235
     protected function getArgument(string $argument)
236 236
     {
237
-        return $this->argumentData[$argument];
237
+        return $this->argumentData[ $argument ];
238 238
     }
239 239
 
240 240
     protected function getOption(string $name)
241 241
     {
242
-        return $this->optionData[$name];
242
+        return $this->optionData[ $name ];
243 243
     }
244 244
 
245 245
     private function getOriginalOptionInput()
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     {
263 263
         $key = str_replace('get', '', $method);
264 264
         if (array_key_exists(strtolower($method), $this->optionData))
265
-            return $this->optionData[$key];
265
+            return $this->optionData[ $key ];
266 266
     }
267 267
 
268 268
     protected function handleOverwriteOption($shortcut, $type, $question, $default)
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,8 +80,9 @@  discard block
 block discarded – undo
80 80
 
81 81
         $this->beforeGeneration();
82 82
 
83
-        if ($this->event === null)
84
-            throw new Exception("No Generator event specified on " . static::class);
83
+        if ($this->event === null) {
84
+                    throw new Exception("No Generator event specified on " . static::class);
85
+        }
85 86
 
86 87
         event(new $this->event($path, $stub));
87 88
         $this->info("Created : {$path}");
@@ -261,8 +262,9 @@  discard block
 block discarded – undo
261 262
     public function __call($method, $parameters)
262 263
     {
263 264
         $key = str_replace('get', '', $method);
264
-        if (array_key_exists(strtolower($method), $this->optionData))
265
-            return $this->optionData[$key];
265
+        if (array_key_exists(strtolower($method), $this->optionData)) {
266
+                    return $this->optionData[$key];
267
+        }
266 268
     }
267 269
 
268 270
     protected function handleOverwriteOption($shortcut, $type, $question, $default)
Please login to merge, or discard this patch.
src/Foundation/Tests/ModuleGeneratorTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $pipeline = $this->moduleFactory->getPipeline();
57 57
 
58 58
         $this->assertIsArray($pipeline);
59
-        $this->assertEquals('Controller', $pipeline[0]['name']);
59
+        $this->assertEquals('Controller', $pipeline[ 0 ][ 'name' ]);
60 60
     }
61 61
 
62 62
     public function testModuleGeneration()
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
         $events = $this->getDispatchedEvents(TestGeneratedEvent::class);
114 114
         $this->assertNotEmpty($events);
115 115
 
116
-        $this->assertEquals($events[0]->getClassName(), "AServiceTest");
117
-        $this->assertEquals($events[0]->getType(), "service");
116
+        $this->assertEquals($events[ 0 ]->getClassName(), "AServiceTest");
117
+        $this->assertEquals($events[ 0 ]->getType(), "service");
118 118
 
119
-        $this->assertEquals($events[1]->getClassName(), "AHttpTest");
120
-        $this->assertEquals($events[1]->getType(), "http");
119
+        $this->assertEquals($events[ 1 ]->getClassName(), "AHttpTest");
120
+        $this->assertEquals($events[ 1 ]->getType(), "http");
121 121
 
122
-        $this->assertEquals($events[2]->getClassName(), "AUnitTest");
123
-        $this->assertEquals($events[2]->getType(), "unit");
122
+        $this->assertEquals($events[ 2 ]->getClassName(), "AUnitTest");
123
+        $this->assertEquals($events[ 2 ]->getType(), "unit");
124 124
 
125 125
         Event::assertDispatched(CommandGeneratedEvent::class, 1);
126 126
 
Please login to merge, or discard this patch.
src/Foundation/Generator/Abstracts/ResourceGeneratedEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
 
84 84
     public function getStubOption(string $option)
85 85
     {
86
-        return $this->getStub()->getOptions()[strtoupper($option)] ?? null;
86
+        return $this->getStub()->getOptions()[ strtoupper($option) ] ?? null;
87 87
     }
88 88
 
89 89
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/TransformerGeneratedEvent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
  */
19 19
 class TransformerGeneratedEvent extends ResourceGeneratedEvent
20 20
 {
21
-    public function getModel(){
21
+    public function getModel() {
22 22
         return $this->getStubOption("model");
23 23
     }
24
-    public function getModelNamespace(){
24
+    public function getModelNamespace() {
25 25
         return $this->getStubOption("model_namespace");
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/MigrationGeneratedEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         return $this->getStubOption("table");
23 23
     }
24 24
 
25
-    public function isMongoMigration(){
25
+    public function isMongoMigration() {
26 26
         return $this->getStubOption("mongo");
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/ListenerGeneratedEvent.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@
 block discarded – undo
18 18
  */
19 19
 class ListenerGeneratedEvent extends ResourceGeneratedEvent
20 20
 {
21
-    public function getEvent(){
21
+    public function getEvent() {
22 22
         return $this->getStubOption("event");
23 23
     }
24 24
 
25
-    public function getEventNamespace(){
25
+    public function getEventNamespace() {
26 26
         return $this->getStubOption("event_namespace");
27 27
     }
28 28
 
29
-    public function isQueued(){
29
+    public function isQueued() {
30 30
         return $this->getStubOption("queued");
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/ComposerGeneratedEvent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
  */
19 19
 class ComposerGeneratedEvent extends ResourceGeneratedEvent
20 20
 {
21
-    public function getAuthorName(){
21
+    public function getAuthorName() {
22 22
         return $this->getStubOption("author_name");
23 23
     }
24 24
 
25
-    public function getAuthorMail(){
25
+    public function getAuthorMail() {
26 26
         return $this->getStubOption("author_mail");
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/TestGeneratedEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
  */
19 19
 class TestGeneratedEvent extends ResourceGeneratedEvent
20 20
 {
21
-    public function getType(){
21
+    public function getType() {
22 22
         return $this->getStubOption("type");
23 23
     }
24 24
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/RouteGeneratedEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
  */
19 19
 class RouteGeneratedEvent extends ResourceGeneratedEvent
20 20
 {
21
-    public function getVersion(){
21
+    public function getVersion() {
22 22
         return $this->getStubOption("version");
23 23
     }
24 24
 }
Please login to merge, or discard this patch.