Passed
Push — master ( 590453...ad5a85 )
by Arthur
24:49
created
src/Foundation/Support/helpers.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
     function get_module_path(string $module)
5 5
     {
6 6
         $module = ucfirst($module);
7
-        $path = base_path('src/Modules') . '/' . $module;
7
+        $path = base_path('src/Modules').'/'.$module;
8 8
         if (file_exists($path)) {
9 9
             return $path;
10 10
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         }
61 61
         $randomIndex = random_int(0, count($array) - 1);
62 62
 
63
-        return $array[$randomIndex];
63
+        return $array[ $randomIndex ];
64 64
     }
65 65
 }
66 66
 if (!function_exists('create_multiple_from_factory')) {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
         $traits = array_flip(class_uses_recursive($class));
111 111
 
112
-        return isset($traits[$trait]);
112
+        return isset($traits[ $trait ]);
113 113
     }
114 114
 }
115 115
 if (!function_exists('array_keys_exists')) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 if (!function_exists('is_associative_array')) {
154 154
     function is_associative_array(array $arr)
155 155
     {
156
-        if ([] === $arr) {
156
+        if ([ ] === $arr) {
157 157
             return false;
158 158
         }
159 159
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $i = 0;
233 233
         foreach ($splittedInCapsName as $word) {
234 234
             if ($i !== 0)
235
-                $splittedString = $splittedString . $word . '_';
235
+                $splittedString = $splittedString.$word.'_';
236 236
             $i++;
237 237
         }
238 238
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -231,8 +231,9 @@
 block discarded – undo
231 231
         $splittedInCapsName = preg_split('/(?=[A-Z])/', $string);
232 232
         $i = 0;
233 233
         foreach ($splittedInCapsName as $word) {
234
-            if ($i !== 0)
235
-                $splittedString = $splittedString . $word . '_';
234
+            if ($i !== 0) {
235
+                            $splittedString = $splittedString . $word . '_';
236
+            }
236 237
             $i++;
237 238
         }
238 239
 
Please login to merge, or discard this patch.
src/Foundation/Tests/HelpersTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     public function testGetClassConstants()
177 177
     {
178 178
         $this->assertArrayHasKey('TEST_CONSTANT', get_class_constants(static::class));
179
-        $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)['TEST_CONSTANT']);
179
+        $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)[ 'TEST_CONSTANT' ]);
180 180
     }
181 181
 
182 182
     public function testInstanceWithoutConstructor()
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $this->assertInstanceOf(Larapi::class, instance_without_constructor(Larapi::class));
185 185
     }
186 186
 
187
-    public function testSplitCapitalStringToUnderscores(){
187
+    public function testSplitCapitalStringToUnderscores() {
188 188
         $this->assertEquals("proxy_uptime_collection", split_caps_to_underscore("ProxyUptimeCollection"));
189 189
     }
190 190
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/TestMakeCommand.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,9 @@
 block discarded – undo
69 69
     {
70 70
         $type = $this->getType();
71 71
 
72
-        if (in_array($type, $this->types))
73
-            return "$type-test.stub";
72
+        if (in_array($type, $this->types)) {
73
+                    return "$type-test.stub";
74
+        }
74 75
 
75 76
         throw new Exception("Test type not supported");
76 77
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
     protected function setOptions(): array
86 86
     {
87 87
         return [
88
-            ['type', $this->types, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.', $this->types[0]]
88
+            [ 'type', $this->types, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.', $this->types[ 0 ] ]
89 89
         ];
90 90
     }
91 91
 
Please login to merge, or discard this patch.
src/Foundation/Traits/DispatchedEvents.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function getDispatchedEvents(?string $class): array
23 23
     {
24
-        $events = [];
25
-        Event::assertDispatched($class, function ($event) use (&$events) {
26
-            $events[] = $event;
24
+        $events = [ ];
25
+        Event::assertDispatched($class, function($event) use (&$events) {
26
+            $events[ ] = $event;
27 27
             return true;
28 28
         });
29 29
         return $events;
@@ -38,6 +38,6 @@  discard block
 block discarded – undo
38 38
         $events = $this->getDispatchedEvents($class);
39 39
         if (empty($events))
40 40
             return null;
41
-        return $events[0];
41
+        return $events[ 0 ];
42 42
     }
43 43
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@
 block discarded – undo
36 36
     protected function getFirstDispatchedEvent(?string $class): ResourceGenerationContract
37 37
     {
38 38
         $events = $this->getDispatchedEvents($class);
39
-        if (empty($events))
40
-            return null;
39
+        if (empty($events)) {
40
+                    return null;
41
+        }
41 42
         return $events[0];
42 43
     }
43 44
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/ModelMakeCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
     protected function setOptions(): array
67 67
     {
68 68
         return [
69
-            ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false],
70
-            ['migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true],
69
+            [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false ],
70
+            [ 'migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true ],
71 71
         ];
72 72
     }
73 73
 
74
-    protected function handleMongoOption($shortcut, $type, $question, $default){
74
+    protected function handleMongoOption($shortcut, $type, $question, $default) {
75 75
         return $this->confirm('Is this model for a mongodb database?', $default);
76 76
     }
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         return $this->getOption('mongo');
81 81
     }
82 82
 
83
-    protected function handleMigrationOption($shortcut, $type, $question, $default){
83
+    protected function handleMigrationOption($shortcut, $type, $question, $default) {
84 84
         return $this->confirm('Do you want to create a migration for this model?', $default);
85 85
     }
86 86
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
         if ($this->needsMigration()) {
95 95
             if ($this->isMongoModel()) {
96 96
                 GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())->createMigration(
97
-                    "Create" . ucfirst($this->getClassName()) . "Collection",
97
+                    "Create".ucfirst($this->getClassName())."Collection",
98 98
                     strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))),
99 99
                     true);
100 100
             } else {
101 101
                 GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())->createMigration(
102
-                    "Create" . ucfirst($this->getClassName() . "Table"),
102
+                    "Create".ucfirst($this->getClassName()."Table"),
103 103
                     strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))),
104 104
                     false);
105 105
             }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if (strtolower($class) === strtolower($this->getModuleName())) {
113 113
             return $class;
114 114
         }
115
-        return ucfirst($this->getModuleName()) . ucfirst($class);
115
+        return ucfirst($this->getModuleName()).ucfirst($class);
116 116
     }
117 117
 
118 118
     /**
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/FactoryMakeCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
     protected function getModelName(): string
56 56
     {
57
-        return once(function () {
58
-            return $this->option('model') ?? $this->anticipate('For what model would you like to generate a factory?', [$this->getModuleName()], $this->getModuleName());
57
+        return once(function() {
58
+            return $this->option('model') ?? $this->anticipate('For what model would you like to generate a factory?', [ $this->getModuleName() ], $this->getModuleName());
59 59
         });
60 60
     }
61 61
 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
     protected function setOptions() :array
82 82
     {
83 83
         return [
84
-            ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null],
84
+            [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null ],
85 85
         ];
86 86
     }
87 87
 
88
-    protected function handleCommandOption($shortcut, $type, $question, $default){
89
-        return $this->anticipate('What is the name of the model?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(),Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[0]);
88
+    protected function handleCommandOption($shortcut, $type, $question, $default) {
89
+        return $this->anticipate('What is the name of the model?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[ 0 ]);
90 90
     }
91 91
 }
Please login to merge, or discard this patch.
src/Foundation/Generator/Commands/ListenerMakeCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
         return [
51 51
             'NAMESPACE' => $this->getClassNamespace(),
52 52
             'CLASS' => $this->getClassName(),
53
-            'EVENTNAME' => $this->getModule()->getNamespace() . '\\' . 'Events' . '\\' . $this->getEventName(),
53
+            'EVENTNAME' => $this->getModule()->getNamespace().'\\'.'Events'.'\\'.$this->getEventName(),
54 54
             'SHORTEVENTNAME' => $this->getEventName()
55 55
         ];
56 56
     }
57 57
 
58 58
     protected function afterGeneration(): void
59 59
     {
60
-        $this->info("don't forget to add the listener to " . $this->getEventName());
60
+        $this->info("don't forget to add the listener to ".$this->getEventName());
61 61
     }
62 62
 
63 63
     /**
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     protected function setOptions(): array
91 91
     {
92 92
         return [
93
-            ['event', null, InputOption::VALUE_OPTIONAL, 'What is the name of the event that should be listened on?', null],
94
-            ['queued', null, InputOption::VALUE_OPTIONAL, 'Should the listener be queued?', false],
93
+            [ 'event', null, InputOption::VALUE_OPTIONAL, 'What is the name of the event that should be listened on?', null ],
94
+            [ 'queued', null, InputOption::VALUE_OPTIONAL, 'Should the listener be queued?', false ],
95 95
         ];
96 96
     }
97 97
 
Please login to merge, or discard this patch.
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()
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/CommandMakeCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     protected function setOptions(): array
69 69
     {
70 70
         return [
71
-            ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null],
71
+            [ 'command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null ],
72 72
         ];
73 73
     }
74 74
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         return $this->getOption('command');
81 81
     }
82 82
 
83
-    protected function handleCommandOption($shortcut, $type, $question, $default){
84
-        return $this->ask('What is the name of the terminal command?',str_replace('command', '', strtolower($this->getModuleName()) . ':' . strtolower($this->getClassName())));
83
+    protected function handleCommandOption($shortcut, $type, $question, $default) {
84
+        return $this->ask('What is the name of the terminal command?', str_replace('command', '', strtolower($this->getModuleName()).':'.strtolower($this->getClassName())));
85 85
     }
86 86
 }
Please login to merge, or discard this patch.