Passed
Push — master ( 40ce26...965fb6 )
by Arthur
22:04
created
src/Foundation/Generator/Commands/RouteMakeCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 
76 76
     protected function getFileName() :string
77 77
     {
78
-        return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion() . '.php';
78
+        return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion().'.php';
79 79
     }
80 80
 
81 81
 
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/ModelMakeCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
     protected function setOptions(): array
66 66
     {
67 67
         return [
68
-            ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false],
69
-            ['migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true],
68
+            [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false ],
69
+            [ 'migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true ],
70 70
         ];
71 71
     }
72 72
 
73
-    protected function handleMongoOption($shortcut, $type, $question, $default){
73
+    protected function handleMongoOption($shortcut, $type, $question, $default) {
74 74
         return $this->confirm('Is this model for a mongodb database?', $default);
75 75
     }
76 76
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         return $this->getOption('mongo');
80 80
     }
81 81
 
82
-    protected function handleMigrationOption($shortcut, $type, $question, $default){
82
+    protected function handleMigrationOption($shortcut, $type, $question, $default) {
83 83
         return $this->confirm('Do you want to create a migration for this model?', $default);
84 84
     }
85 85
 
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
         if ($this->needsMigration()) {
94 94
             if ($this->isMongoModel()) {
95 95
                 GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())->createMigration(
96
-                    "Create" . ucfirst($this->getClassName()) . "Collection",
96
+                    "Create".ucfirst($this->getClassName())."Collection",
97 97
                     strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))),
98 98
                     true);
99 99
             } else {
100 100
                 GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())->createMigration(
101
-                    "Create" . ucfirst($this->getClassName() . "Table"),
101
+                    "Create".ucfirst($this->getClassName()."Table"),
102 102
                     strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))),
103 103
                     false);
104 104
             }
Please login to merge, or discard this patch.
src/Foundation/Generator/Events/ModelGeneratedEvent.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
  */
19 19
 class ModelGeneratedEvent extends ResourceGeneratedEvent
20 20
 {
21
-    public function isMongoModel(){
22
-        return $this->getStub()->getOptions()['MONGO'];
21
+    public function isMongoModel() {
22
+        return $this->getStub()->getOptions()[ 'MONGO' ];
23 23
     }
24 24
 
25
-    public function includesMigration(){
26
-        return $this->getStub()->getOptions()['MIGRATION'];
25
+    public function includesMigration() {
26
+        return $this->getStub()->getOptions()[ 'MIGRATION' ];
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Abstracts/ClassGeneratorCommand.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
     protected function setArguments() :array
28 28
     {
29 29
         return [
30
-            ['name', InputArgument::OPTIONAL, 'The name of the ' . $this->getGeneratorName() . '.']
30
+            [ 'name', InputArgument::OPTIONAL, 'The name of the '.$this->getGeneratorName().'.' ]
31 31
         ];
32 32
     }
33 33
 
34 34
     protected function handleNameArgument()
35 35
     {
36
-        return $this->ask('Specify the name of the ' . $this->getGeneratorName() . '.');
36
+        return $this->ask('Specify the name of the '.$this->getGeneratorName().'.');
37 37
     }
38 38
 
39 39
     /**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function getFileName() :string
43 43
     {
44
-        return $this->getClassName() . '.php';
44
+        return $this->getClassName().'.php';
45 45
     }
46 46
 
47 47
     /**
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function getClassNamespace(): string
54 54
     {
55
-        return $this->getModule()->getNamespace() . str_replace('/', '\\', $this->filePath);
55
+        return $this->getModule()->getNamespace().str_replace('/', '\\', $this->filePath);
56 56
     }
57 57
 
58
-    protected function getClassName(){
58
+    protected function getClassName() {
59 59
         $className = $this->getArgument('name');
60
-        if($className===null){
60
+        if ($className === null) {
61 61
             $this->error('class name not specified');
62
-            throw new \Exception('Name of ' . $this->getGeneratorName() . ' not set.');
62
+            throw new \Exception('Name of '.$this->getGeneratorName().' not set.');
63 63
         }
64 64
         return $className;
65 65
     }
@@ -71,6 +71,6 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function setOptions() :array
73 73
     {
74
-        return [];
74
+        return [ ];
75 75
     }
76 76
 }
Please login to merge, or discard this patch.
src/Foundation/Tests/FileGeneratorTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $moduleName = "User";
88 88
         $this->getModuleGenerator($moduleName)->createFactory("User");
89 89
 
90
-        $expectedFileName = Larapi::getModule($moduleName)->getFactories()->getPath() . '/UserFactory.php';
90
+        $expectedFileName = Larapi::getModule($moduleName)->getFactories()->getPath().'/UserFactory.php';
91 91
         $expectedStubName = "factory.stub";
92 92
         $expectedStubOptions = [
93 93
             'CLASS' => 'UserFactory',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $moduleName = "User";
110 110
         $this->getModuleGenerator($moduleName)->createController("UserController");
111 111
 
112
-        $expectedFileName = Larapi::getModule($moduleName)->getControllers()->getPath() . '/UserController.php';
112
+        $expectedFileName = Larapi::getModule($moduleName)->getControllers()->getPath().'/UserController.php';
113 113
         $expectedStubName = "controller.stub";
114 114
         $expectedStubOptions = [
115 115
             'CLASS' => 'UserController',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $moduleName = "User";
131 131
         $this->getModuleGenerator($moduleName)->createListener("SendWelcomeMail", "UserRegisteredEvent");
132 132
 
133
-        $expectedFileName = Larapi::getModule($moduleName)->getListeners()->getPath() . '/SendWelcomeMail.php';
133
+        $expectedFileName = Larapi::getModule($moduleName)->getListeners()->getPath().'/SendWelcomeMail.php';
134 134
         $expectedStubName = "listener.stub";
135 135
         $expectedStubOptions = [
136 136
             'CLASS' => 'SendWelcomeMail',
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $fileName = "RandomUserJob";
165 165
         $this->getModuleGenerator($moduleName)->createJob($fileName, false);
166 166
 
167
-        $expectedFileName = Larapi::getModule($moduleName)->getJobs()->getPath() . "/$fileName.php";
167
+        $expectedFileName = Larapi::getModule($moduleName)->getJobs()->getPath()."/$fileName.php";
168 168
         $expectedStubName = "job-queued.stub";
169 169
         $expectedStubOptions = [
170 170
             'NAMESPACE' => 'Modules\User\Jobs',
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
         $this->getModuleGenerator($moduleName)->createCommand($fileName, $commandName);
200 200
 
201
-        $expectedFileName = Larapi::getModule($moduleName)->getCommands()->getPath() . "/$fileName.php";
201
+        $expectedFileName = Larapi::getModule($moduleName)->getCommands()->getPath()."/$fileName.php";
202 202
         $expectedStubName = "command.stub";
203 203
         $expectedStubOptions = [
204 204
             'NAMESPACE' => 'Modules\User\Console',
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
         $this->getModuleGenerator($moduleName)->createMiddleware($fileName);
228 228
 
229
-        $expectedFileName = Larapi::getModule($moduleName)->getMiddleWare()->getPath() . "/$fileName.php";
229
+        $expectedFileName = Larapi::getModule($moduleName)->getMiddleWare()->getPath()."/$fileName.php";
230 230
         $expectedStubName = "middleware.stub";
231 231
         $expectedStubOptions = [
232 232
             'CLASS' => 'RandomMiddleware',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         $this->getModuleGenerator($moduleName)->createServiceProvider($fileName);
251 251
 
252
-        $expectedFileName = Larapi::getModule($moduleName)->getServiceProviders()->getPath() . "/$fileName.php";
252
+        $expectedFileName = Larapi::getModule($moduleName)->getServiceProviders()->getPath()."/$fileName.php";
253 253
         $expectedStubName = "provider.stub";
254 254
         $expectedStubOptions = [
255 255
             'NAMESPACE' => 'Modules\User\Providers',
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $this->getModuleGenerator($moduleName)->createNotification($fileName);
274 274
 
275
-        $expectedFileName = Larapi::getModule($moduleName)->getNotifications()->getPath() . "/$fileName.php";
275
+        $expectedFileName = Larapi::getModule($moduleName)->getNotifications()->getPath()."/$fileName.php";
276 276
         $expectedStubName = "notification.stub";
277 277
         $expectedStubOptions = [
278 278
             'NAMESPACE' => 'Modules\User\Notifications',
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
         $moduleName = "User";
294 294
         $fileName = "Address";
295 295
 
296
-        $this->getModuleGenerator($moduleName)->createModel($moduleName . $fileName, false, true);
296
+        $this->getModuleGenerator($moduleName)->createModel($moduleName.$fileName, false, true);
297 297
 
298
-        $expectedFileName = Larapi::getModule($moduleName)->getModels()->getPath() . "/$moduleName$fileName.php";
298
+        $expectedFileName = Larapi::getModule($moduleName)->getModels()->getPath()."/$moduleName$fileName.php";
299 299
         $expectedStubName = "model.stub";
300 300
         $expectedStubOptions = [
301 301
             'NAMESPACE' => 'Modules\User\Entities',
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
         $this->getModuleGenerator($moduleName)->createPolicy($fileName);
334 334
 
335
-        $expectedFileName = Larapi::getModule($moduleName)->getPolicies()->getPath() . "/$fileName.php";
335
+        $expectedFileName = Larapi::getModule($moduleName)->getPolicies()->getPath()."/$fileName.php";
336 336
         $expectedStubName = "policy.stub";
337 337
         $expectedStubOptions = [
338 338
             'NAMESPACE' => 'Modules\User\Policies',
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
         $this->getModuleGenerator($moduleName)->createTransformer($fileName, $model);
357 357
 
358
-        $expectedFileName = Larapi::getModule($moduleName)->getTransformers()->getPath() . "/$fileName.php";
358
+        $expectedFileName = Larapi::getModule($moduleName)->getTransformers()->getPath()."/$fileName.php";
359 359
         $expectedStubName = "transformer.stub";
360 360
         $expectedStubOptions = [
361 361
             'NAMESPACE' => 'Modules\User\Transformers',
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
         $this->getModuleGenerator($moduleName)->createTest($fileName, 'unit');
381 381
 
382
-        $expectedFileName = Larapi::getModule($moduleName)->getTests()->getPath() . "/$fileName.php";
382
+        $expectedFileName = Larapi::getModule($moduleName)->getTests()->getPath()."/$fileName.php";
383 383
         $expectedStubName = "unit-test.stub";
384 384
         $expectedStubOptions = [
385 385
             'NAMESPACE' => 'Modules\User\Tests',
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
         $this->getModuleGenerator($moduleName)->createRequest($fileName);
404 404
 
405
-        $expectedFileName = Larapi::getModule($moduleName)->getRequests()->getPath() . "/$fileName.php";
405
+        $expectedFileName = Larapi::getModule($moduleName)->getRequests()->getPath()."/$fileName.php";
406 406
         $expectedStubName = "request.stub";
407 407
         $expectedStubOptions = [
408 408
             'NAMESPACE' => 'Modules\User\Http\Requests',
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
         $this->getModuleGenerator($moduleName)->createRule($fileName);
426 426
 
427
-        $expectedFileName = Larapi::getModule($moduleName)->getRules()->getPath() . "/$fileName.php";
427
+        $expectedFileName = Larapi::getModule($moduleName)->getRules()->getPath()."/$fileName.php";
428 428
         $expectedStubName = "rule.stub";
429 429
         $expectedStubOptions = [
430 430
             'NAMESPACE' => 'Modules\User\Rules',
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
         $this->getModuleGenerator($moduleName)->createSeeder($fileName);
448 448
 
449
-        $expectedFileName = Larapi::getModule($moduleName)->getSeeders()->getPath() . "/$fileName.php";
449
+        $expectedFileName = Larapi::getModule($moduleName)->getSeeders()->getPath()."/$fileName.php";
450 450
         $expectedStubName = "seeder.stub";
451 451
         $expectedStubOptions = [
452 452
             'NAMESPACE' => 'Modules\User\Database\Seeders',
@@ -464,11 +464,11 @@  discard block
 block discarded – undo
464 464
     public function testCreateRoute()
465 465
     {
466 466
         $moduleName = "Demo";
467
-        $routename = strtolower(Str::plural($moduleName)) . '.v1';
467
+        $routename = strtolower(Str::plural($moduleName)).'.v1';
468 468
 
469 469
         $this->getModuleGenerator($moduleName)->createRoute();
470 470
 
471
-        $expectedFileName = Larapi::getModule($moduleName)->getRoutes()->getPath() . "/$routename.php";
471
+        $expectedFileName = Larapi::getModule($moduleName)->getRoutes()->getPath()."/$routename.php";
472 472
         $expectedStubName = "route.stub";
473 473
         $expectedStubOptions = [
474 474
             'MODULE_NAME' => 'Demo',
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
         $this->getModuleGenerator($moduleName)->createComposer();
492 492
 
493
-        $expectedFileName = Larapi::getModule($moduleName)->getPath() . "/composer.json";
493
+        $expectedFileName = Larapi::getModule($moduleName)->getPath()."/composer.json";
494 494
         $expectedStubName = "composer.stub";
495 495
         $expectedStubOptions = [
496 496
             'LOWER_MODULE_NAME' => 'demo',
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/FactoryMakeCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     protected function getClassName(): string
55 55
     {
56
-        return $this->getModelName() . 'Factory';
56
+        return $this->getModelName().'Factory';
57 57
     }
58 58
 
59 59
     protected function stubOptions(): array
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         return [
62 62
             'CLASS' => $this->getClassName(),
63 63
             'MODEL' => $this->getModelName(),
64
-            'MODEL_NAMESPACE' => $this->getModule()->getNamespace() . '\\' . 'Entities' . '\\' . $this->getModelName(),
64
+            'MODEL_NAMESPACE' => $this->getModule()->getNamespace().'\\'.'Entities'.'\\'.$this->getModelName(),
65 65
         ];
66 66
     }
67 67
 
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
     protected function setOptions(): array
74 74
     {
75 75
         return [
76
-            ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null],
76
+            [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null ],
77 77
         ];
78 78
     }
79 79
 
80 80
     protected function handleModelOption($shortcut, $type, $question, $default)
81 81
     {
82
-        return $this->anticipate('For what model would you like to generate a factory?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[0] ?? "");
82
+        return $this->anticipate('For what model would you like to generate a factory?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[ 0 ] ?? "");
83 83
     }
84 84
 
85 85
     protected function getModelName() :string
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/ModuleMakeCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     protected function getArguments()
53 53
     {
54 54
         return [
55
-            ['name', InputArgument::REQUIRED, 'The name of the module that will be created.'],
55
+            [ 'name', InputArgument::REQUIRED, 'The name of the module that will be created.' ],
56 56
         ];
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/TransformerMakeCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     protected function setOptions() :array
72 72
     {
73 73
         return [
74
-            ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null],
74
+            [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null ],
75 75
         ];
76 76
     }
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         return $this->getOption("model");
81 81
     }
82 82
 
83
-    protected function handleModelOption(){
83
+    protected function handleModelOption() {
84 84
         return $this->anticipate('For what model would you like to generate a transformer?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), $this->getModuleName());
85 85
     }
86 86
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Generators/DefaultModuleGenerator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,37 +40,37 @@
 block discarded – undo
40 40
     /**
41 41
      *
42 42
      */
43
-    public function generate(){
43
+    public function generate() {
44 44
 
45 45
         $this->moduleFactory->addModel($this->moduleName, true, true);
46 46
 
47
-        $this->moduleFactory->addService($this->moduleName . 'Service');
47
+        $this->moduleFactory->addService($this->moduleName.'Service');
48 48
 
49
-        $this->moduleFactory->addController($this->moduleName . "Controller");
49
+        $this->moduleFactory->addController($this->moduleName."Controller");
50 50
 
51
-        $this->moduleFactory->addTest($this->moduleName . 'ServiceTest', 'service');
52
-        $this->moduleFactory->addTest($this->moduleName . 'HttpTest', 'http');
53
-        $this->moduleFactory->addTest($this->moduleName . 'UnitTest', 'unit');
51
+        $this->moduleFactory->addTest($this->moduleName.'ServiceTest', 'service');
52
+        $this->moduleFactory->addTest($this->moduleName.'HttpTest', 'http');
53
+        $this->moduleFactory->addTest($this->moduleName.'UnitTest', 'unit');
54 54
 
55
-        $this->moduleFactory->addEvent($this->moduleName . 'WasCreatedEvent');
56
-        $this->moduleFactory->addEvent($this->moduleName . 'WasUpdatedEvent');
57
-        $this->moduleFactory->addEvent($this->moduleName . 'WasDeletedEvent');
55
+        $this->moduleFactory->addEvent($this->moduleName.'WasCreatedEvent');
56
+        $this->moduleFactory->addEvent($this->moduleName.'WasUpdatedEvent');
57
+        $this->moduleFactory->addEvent($this->moduleName.'WasDeletedEvent');
58 58
 
59
-        $this->moduleFactory->addRequest('Find'.$this->moduleName . 'Request');
60
-        $this->moduleFactory->addRequest('Index'.$this->moduleName . 'Request');
61
-        $this->moduleFactory->addRequest('Create'.$this->moduleName . 'Request');
62
-        $this->moduleFactory->addRequest('Update'.$this->moduleName . 'Request');
63
-        $this->moduleFactory->addRequest('Delete'.$this->moduleName . 'Request');
59
+        $this->moduleFactory->addRequest('Find'.$this->moduleName.'Request');
60
+        $this->moduleFactory->addRequest('Index'.$this->moduleName.'Request');
61
+        $this->moduleFactory->addRequest('Create'.$this->moduleName.'Request');
62
+        $this->moduleFactory->addRequest('Update'.$this->moduleName.'Request');
63
+        $this->moduleFactory->addRequest('Delete'.$this->moduleName.'Request');
64 64
 
65
-        $this->moduleFactory->addPermission($this->moduleName . 'Permission');
65
+        $this->moduleFactory->addPermission($this->moduleName.'Permission');
66 66
 
67
-        $this->moduleFactory->addPolicy($this->moduleName . 'Policy');
67
+        $this->moduleFactory->addPolicy($this->moduleName.'Policy');
68 68
 
69 69
         $this->moduleFactory->addFactory($this->moduleName);
70 70
 
71 71
         $this->moduleFactory->addTransformer($this->moduleName.'Transformer', $this->moduleName);
72 72
 
73
-        $this->moduleFactory->addServiceProvider($this->moduleName . 'ServiceProvider');
73
+        $this->moduleFactory->addServiceProvider($this->moduleName.'ServiceProvider');
74 74
 
75 75
         $this->moduleFactory->addRoute();
76 76
 
Please login to merge, or discard this patch.