Test Failed
Push — develop ( a061b1...df8064 )
by nguereza
02:52
created
src/Console/Command/MakeActionCommand.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
     ) {
77 77
         parent::__construct($application, $filesystem);
78 78
         $this->setName('make:action')
79
-               ->setDescription('Command to generate new request handler class');
79
+                ->setDescription('Command to generate new request handler class');
80 80
     }
81 81
 
82 82
     /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
  * @class MakeActionCommand
59 59
  * @package Platine\Framework\Console\Command
60 60
  */
61
-class MakeActionCommand extends MakeCommand
62
-{
61
+class MakeActionCommand extends MakeCommand {
63 62
     /**
64 63
      * {@inheritdoc}
65 64
      */
@@ -73,7 +72,7 @@  discard block
 block discarded – undo
73 72
     public function __construct(
74 73
         Application $application,
75 74
         Filesystem $filesystem
76
-    ) {
75
+    ) {
77 76
         parent::__construct($application, $filesystem);
78 77
         $this->setName('make:action')
79 78
                ->setDescription('Command to generate new request handler class');
@@ -91,14 +90,14 @@  discard block
 block discarded – undo
91 90
         $io = $this->io();
92 91
         $writer->boldYellow('Enter the properties list (empty value to finish):', true);
93 92
         $value = '';
94
-        while ($value !== null) {
93
+        while ($value !== null) {
95 94
             $value = $io->prompt('Property full class name', null, null, false);
96 95
 
97
-            if (!empty($value)) {
96
+            if (!empty($value)) {
98 97
                 $value = trim($value);
99
-                if (!class_exists($value) && !interface_exists($value)) {
98
+                if (!class_exists($value) && !interface_exists($value)) {
100 99
                     $writer->boldWhiteBgRed(sprintf('The class [%s] does not exists', $value), true);
101
-                } else {
100
+                } else {
102 101
                     $shortClass = $this->getClassBaseName($value);
103 102
                     $name = Str::camel($shortClass, true);
104 103
                     //replace"interface", "abstract"
Please login to merge, or discard this patch.
src/Console/Command/MaintenanceCommand.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $this->config = $config;
86 86
 
87 87
         $this->setName('maintenance')
88
-             ->setDescription('Command to manage application maintenance');
88
+                ->setDescription('Command to manage application maintenance');
89 89
 
90 90
         $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function ($val) {
91 91
             if (!in_array($val, ['up', 'down', 'status'])) {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 ));
96 96
             }
97 97
 
98
-             return $val;
98
+                return $val;
99 99
         });
100 100
 
101 101
         $this->addOption(
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $this->setName('maintenance')
88 88
              ->setDescription('Command to manage application maintenance');
89 89
 
90
-        $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function ($val) {
90
+        $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function($val) {
91 91
             if (!in_array($val, ['up', 'down', 'status'])) {
92 92
                 throw new RuntimeException(sprintf(
93 93
                     'Invalid argument type [%s], must be one of [up, down, status]',
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             false,
114 114
             true,
115 115
             false,
116
-            function ($val) {
116
+            function($val) {
117 117
                 if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) {
118 118
                     throw new RuntimeException(sprintf(
119 119
                         'Invalid retry value [%s], must be an integer greather than zero',
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             false,
132 132
             true,
133 133
             false,
134
-            function ($val) {
134
+            function($val) {
135 135
                 if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) {
136 136
                     throw new RuntimeException(sprintf(
137 137
                         'Invalid refresh value [%s], must be an integer greather than zero',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             false,
157 157
             true,
158 158
             false,
159
-            function ($val) {
159
+            function($val) {
160 160
                 if (strlen($val) > 0 && (!is_numeric($val) || (int) $val < 200 || (int) $val > 505)) {
161 161
                     throw new RuntimeException(sprintf(
162 162
                         'Invalid HTTP status value [%s], must be between 200 and 505',
Please login to merge, or discard this patch.
Braces   +25 added lines, -27 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
  * @package Platine\Framework\Console\Command
59 59
  * @template T
60 60
  */
61
-class MaintenanceCommand extends Command
62
-{
61
+class MaintenanceCommand extends Command {
63 62
     /**
64 63
      * The configuration to use
65 64
      * @var Config<T>
@@ -80,15 +79,15 @@  discard block
 block discarded – undo
80 79
     public function __construct(
81 80
         Application $app,
82 81
         Config $config
83
-    ) {
82
+    ) {
84 83
         $this->application = $app;
85 84
         $this->config = $config;
86 85
 
87 86
         $this->setName('maintenance')
88 87
              ->setDescription('Command to manage application maintenance');
89 88
 
90
-        $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function ($val) {
91
-            if (!in_array($val, ['up', 'down', 'status'])) {
89
+        $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function ($val) {
90
+            if (!in_array($val, ['up', 'down', 'status'])) {
92 91
                 throw new RuntimeException(sprintf(
93 92
                     'Invalid argument type [%s], must be one of [up, down, status]',
94 93
                     $val
@@ -113,8 +112,8 @@  discard block
 block discarded – undo
113 112
             false,
114 113
             true,
115 114
             false,
116
-            function ($val) {
117
-                if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) {
115
+            function ($val) {
116
+                if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) {
118 117
                     throw new RuntimeException(sprintf(
119 118
                         'Invalid retry value [%s], must be an integer greather than zero',
120 119
                         $val
@@ -131,8 +130,8 @@  discard block
 block discarded – undo
131 130
             false,
132 131
             true,
133 132
             false,
134
-            function ($val) {
135
-                if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) {
133
+            function ($val) {
134
+                if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) {
136 135
                     throw new RuntimeException(sprintf(
137 136
                         'Invalid refresh value [%s], must be an integer greather than zero',
138 137
                         $val
@@ -156,8 +155,8 @@  discard block
 block discarded – undo
156 155
             false,
157 156
             true,
158 157
             false,
159
-            function ($val) {
160
-                if (strlen($val) > 0 && (!is_numeric($val) || (int) $val < 200 || (int) $val > 505)) {
158
+            function ($val) {
159
+                if (strlen($val) > 0 && (!is_numeric($val) || (int) $val < 200 || (int) $val > 505)) {
161 160
                     throw new RuntimeException(sprintf(
162 161
                         'Invalid HTTP status value [%s], must be between 200 and 505',
163 162
                         $val
@@ -179,19 +178,18 @@  discard block
 block discarded – undo
179 178
     /**
180 179
      * {@inheritdoc}
181 180
      */
182
-    public function execute()
183
-    {
181
+    public function execute() {
184 182
         $type = $this->getArgumentValue('type');
185 183
 
186 184
         $io = $this->io();
187 185
         $writer = $io->writer();
188 186
         $writer->boldYellow('APPLICATION MAINTENANCE MANAGEMENT', true)->eol();
189 187
 
190
-        if ($type === 'up') {
188
+        if ($type === 'up') {
191 189
             $this->online();
192
-        } elseif ($type === 'down') {
190
+        } elseif ($type === 'down') {
193 191
             $this->down();
194
-        } else {
192
+        } else {
195 193
             $this->status();
196 194
         }
197 195
     }
@@ -204,8 +202,8 @@  discard block
 block discarded – undo
204 202
     {
205 203
         $writer = $this->io()->writer();
206 204
 
207
-        try {
208
-            if ($this->application->isInMaintenance() === false) {
205
+        try {
206
+            if ($this->application->isInMaintenance() === false) {
209 207
                 $writer->boldRed('Application already online')->eol();
210 208
                 return;
211 209
             }
@@ -213,7 +211,7 @@  discard block
 block discarded – undo
213 211
             $this->application->maintenance()->deactivate();
214 212
 
215 213
             $writer->boldGreen('Application is now online')->eol();
216
-        } catch (Throwable $ex) {
214
+        } catch (Throwable $ex) {
217 215
             $writer->boldRed(sprintf(
218 216
                 'Failed to disable maintenance mode: %s.',
219 217
                 $ex->getMessage()
@@ -229,8 +227,8 @@  discard block
 block discarded – undo
229 227
     {
230 228
         $writer = $this->io()->writer();
231 229
 
232
-        try {
233
-            if ($this->application->isInMaintenance()) {
230
+        try {
231
+            if ($this->application->isInMaintenance()) {
234 232
                 $writer->boldRed('Application is already down.')->eol();
235 233
                 return;
236 234
             }
@@ -239,7 +237,7 @@  discard block
 block discarded – undo
239 237
             $this->application->maintenance()->activate($data);
240 238
 
241 239
             $writer->boldGreen('Application is now in maintenance mode.')->eol();
242
-        } catch (Throwable $ex) {
240
+        } catch (Throwable $ex) {
243 241
             $writer->boldRed(sprintf(
244 242
                 'Failed to enable maintenance mode: %s.',
245 243
                 $ex->getMessage()
@@ -255,9 +253,9 @@  discard block
 block discarded – undo
255 253
     {
256 254
         $writer = $this->io()->writer();
257 255
 
258
-        if ($this->application->isInMaintenance()) {
256
+        if ($this->application->isInMaintenance()) {
259 257
             $writer->boldYellow('Application is down.')->eol();
260
-        } else {
258
+        } else {
261 259
             $writer->boldGreen('Application is online.')->eol();
262 260
         }
263 261
     }
@@ -269,17 +267,17 @@  discard block
 block discarded – undo
269 267
     protected function getPayload(): array
270 268
     {
271 269
         $retry = $this->getOptionValue('retry') ?? 3600;
272
-        if ($retry) {
270
+        if ($retry) {
273 271
             $retry = (int) $retry;
274 272
         }
275 273
 
276 274
         $refresh = $this->getOptionValue('refresh') ?? 3600;
277
-        if ($refresh) {
275
+        if ($refresh) {
278 276
             $refresh = (int) $refresh;
279 277
         }
280 278
 
281 279
         $status = $this->getOptionValue('status') ?? 503;
282
-        if ($status) {
280
+        if ($status) {
283 281
             $status = (int) $status;
284 282
         }
285 283
 
Please login to merge, or discard this patch.
src/Console/Command/MakeEventCommand.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
     ) {
74 74
         parent::__construct($application, $filesystem);
75 75
         $this->setName('make:event')
76
-               ->setDescription('Command to generate new event class');
76
+                ->setDescription('Command to generate new event class');
77 77
     }
78 78
 
79 79
     /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * @class MakeEventCommand
56 56
  * @package Platine\Framework\Console\Command
57 57
  */
58
-class MakeEventCommand extends MakeCommand
59
-{
58
+class MakeEventCommand extends MakeCommand {
60 59
     /**
61 60
      * {@inheritdoc}
62 61
      */
@@ -70,7 +69,7 @@  discard block
 block discarded – undo
70 69
     public function __construct(
71 70
         Application $application,
72 71
         Filesystem $filesystem
73
-    ) {
72
+    ) {
74 73
         parent::__construct($application, $filesystem);
75 74
         $this->setName('make:event')
76 75
                ->setDescription('Command to generate new event class');
Please login to merge, or discard this patch.
src/Console/Command/MakeListenerCommand.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
     ) {
82 82
         parent::__construct($application, $filesystem);
83 83
         $this->setName('make:listener')
84
-               ->setDescription('Command to generate new event listener class');
84
+                ->setDescription('Command to generate new event listener class');
85 85
     }
86 86
 
87 87
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @class MakeListenerCommand
58 58
  * @package Platine\Framework\Console\Command
59 59
  */
60
-class MakeListenerCommand extends MakeCommand
61
-{
60
+class MakeListenerCommand extends MakeCommand {
62 61
     /**
63 62
      * {@inheritdoc}
64 63
      */
@@ -78,7 +77,7 @@  discard block
 block discarded – undo
78 77
     public function __construct(
79 78
         Application $application,
80 79
         Filesystem $filesystem
81
-    ) {
80
+    ) {
82 81
         parent::__construct($application, $filesystem);
83 82
         $this->setName('make:listener')
84 83
                ->setDescription('Command to generate new event listener class');
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
         $io = $this->io();
96 95
 
97 96
         $eventClass = $io->prompt('Enter the event full class name', null);
98
-        while (!class_exists($eventClass)) {
97
+        while (!class_exists($eventClass)) {
99 98
             $eventClass = $io->prompt('Class does not exists, please enter the event full class name', null);
100 99
         }
101 100
 
Please login to merge, or discard this patch.
src/Console/Command/MakeFormParamCommand.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
     ) {
89 89
         parent::__construct($application, $filesystem);
90 90
         $this->setName('make:param')
91
-               ->setDescription('Command to generate new form parameter class');
91
+                ->setDescription('Command to generate new form parameter class');
92 92
     }
93 93
 
94 94
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
                 }
124 124
 
125 125
                 if (isset($values[2])) {
126
-                    $required = in_array($values[2], ['true', '1', 'yes', 'on', 'y']) ;
126
+                    $required = in_array($values[2], ['true', '1', 'yes', 'on', 'y']);
127 127
                 }
128 128
 
129 129
                 if (isset($values[3])) {
Please login to merge, or discard this patch.
Braces   +25 added lines, -26 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
  * @class MakeFormParamCommand
59 59
  * @package Platine\Framework\Console\Command
60 60
  */
61
-class MakeFormParamCommand extends MakeCommand
62
-{
61
+class MakeFormParamCommand extends MakeCommand {
63 62
     /**
64 63
      * {@inheritdoc}
65 64
      */
@@ -85,7 +84,7 @@  discard block
 block discarded – undo
85 84
     public function __construct(
86 85
         Application $application,
87 86
         Filesystem $filesystem
88
-    ) {
87
+    ) {
89 88
         parent::__construct($application, $filesystem);
90 89
         $this->setName('make:param')
91 90
                ->setDescription('Command to generate new form parameter class');
@@ -103,10 +102,10 @@  discard block
 block discarded – undo
103 102
         $io = $this->io();
104 103
         $writer->boldYellow('Enter the properties list (empty value to finish):', true);
105 104
         $value = '';
106
-        while ($value !== null) {
105
+        while ($value !== null) {
107 106
             $value = $io->prompt('Property name', null, null, false);
108 107
 
109
-            if (!empty($value)) {
108
+            if (!empty($value)) {
110 109
                 $value = trim($value);
111 110
                 $type = 'string';
112 111
                 $required = true;
@@ -114,19 +113,19 @@  discard block
 block discarded – undo
114 113
 
115 114
                 // 0 = field name, 1 = data type, 2 = required (true/false), 3 = default value
116 115
                 $values = (array) explode(':', $value);
117
-                if (isset($values[0]) && !empty($values[0])) {
116
+                if (isset($values[0]) && !empty($values[0])) {
118 117
                     $value = $values[0];
119 118
                 }
120 119
 
121
-                if (isset($values[1]) && !empty($values[1])) {
120
+                if (isset($values[1]) && !empty($values[1])) {
122 121
                     $type = $values[1];
123 122
                 }
124 123
 
125
-                if (isset($values[2])) {
124
+                if (isset($values[2])) {
126 125
                     $required = in_array($values[2], ['true', '1', 'yes', 'on', 'y']) ;
127 126
                 }
128 127
 
129
-                if (isset($values[3])) {
128
+                if (isset($values[3])) {
130 129
                     $default = $values[3];
131 130
                 }
132 131
 
@@ -144,24 +143,24 @@  discard block
 block discarded – undo
144 143
 
145 144
         $this->properties = $properties;
146 145
 
147
-        if (!empty($this->properties)) {
146
+        if (!empty($this->properties)) {
148 147
             $this->createInstanceFormEntity = $io->confirm('Create instance from entity ?', 'y');
149 148
 
150
-            if ($this->createInstanceFormEntity) {
149
+            if ($this->createInstanceFormEntity) {
151 150
                 $list = [];
152
-                foreach ($this->properties as $name => $info) {
151
+                foreach ($this->properties as $name => $info) {
153 152
                     $value = $io->prompt(
154 153
                         sprintf('Entity field name for [%s] (just enter to ignore)', $name),
155 154
                         null,
156 155
                         null,
157 156
                         false
158 157
                     );
159
-                    if (!empty($value)) {
158
+                    if (!empty($value)) {
160 159
                         $list[$name] = $value;
161 160
                     }
162 161
                 }
163 162
 
164
-                if (!empty($list)) {
163
+                if (!empty($list)) {
165 164
                     $this->fromEntityMaps = $list;
166 165
                 }
167 166
             }
@@ -220,7 +219,7 @@  discard block
 block discarded – undo
220 219
     protected function getSettersBody(string $content): string
221 220
     {
222 221
         $result = '';
223
-        foreach ($this->properties as $info) {
222
+        foreach ($this->properties as $info) {
224 223
             $result .= $this->getSetterTemplate($info);
225 224
         }
226 225
 
@@ -236,7 +235,7 @@  discard block
 block discarded – undo
236 235
     {
237 236
         $result = '';
238 237
 
239
-        foreach ($this->properties as $info) {
238
+        foreach ($this->properties as $info) {
240 239
             $result .= $this->getGetterTemplate($info);
241 240
         }
242 241
 
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
         $typeDockBlock = $type;
256 255
         $typeArg = $type;
257 256
         $required = $info['required'];
258
-        if ($required === false) {
257
+        if ($required === false) {
259 258
             $typeDockBlock .= '|null';
260 259
             $typeArg = '?' . $typeArg;
261 260
         }
@@ -291,7 +290,7 @@  discard block
 block discarded – undo
291 290
         $typeDockBlock = $type;
292 291
         $typeReturn = $type;
293 292
         $required = $info['required'];
294
-        if ($required === false) {
293
+        if ($required === false) {
295 294
             $typeDockBlock .= '|null';
296 295
             $typeReturn = '?' . $typeReturn;
297 296
         }
@@ -321,7 +320,7 @@  discard block
 block discarded – undo
321 320
     {
322 321
         $result = '';
323 322
         $templateEntity = '';
324
-        if ($this->createInstanceFormEntity && !empty($this->fromEntityMaps)) {
323
+        if ($this->createInstanceFormEntity && !empty($this->fromEntityMaps)) {
325 324
             $templateEntity = '@template TEntity as Entity';
326 325
             $result = <<<EOF
327 326
             /**
@@ -332,7 +331,7 @@  discard block
 block discarded – undo
332 331
                {
333 332
                 
334 333
             EOF;
335
-            foreach ($this->fromEntityMaps as $property => $map) {
334
+            foreach ($this->fromEntityMaps as $property => $map) {
336 335
                 $result .= <<<EOF
337 336
                 \$this->$property = \$entity->$map;
338 337
                 
@@ -365,22 +364,22 @@  discard block
 block discarded – undo
365 364
         $typeDockBlock = $type;
366 365
         $typeProp = $type;
367 366
         $required = $info['required'];
368
-        if ($required === false) {
367
+        if ($required === false) {
369 368
             $typeDockBlock .= '|null';
370 369
             $typeProp = '?' . $typeProp;
371 370
         }
372 371
 
373
-        if ($default === null && $required === false) {
372
+        if ($default === null && $required === false) {
374 373
             $default = 'null';
375 374
         }
376 375
 
377
-        if ($default !== null) {
378
-            if ($type === 'string' && empty($default)) {
376
+        if ($default !== null) {
377
+            if ($type === 'string' && empty($default)) {
379 378
                 $default = '\'\'';
380 379
             }
381 380
 
382 381
             $default = ' = ' . $default;
383
-        } else {
382
+        } else {
384 383
             $default = '';
385 384
         }
386 385
 
@@ -400,7 +399,7 @@  discard block
 block discarded – undo
400 399
      */
401 400
     protected function getUsesContent(): string
402 401
     {
403
-        if (!$this->createInstanceFormEntity) {
402
+        if (!$this->createInstanceFormEntity) {
404 403
             return '';
405 404
         }
406 405
 
Please login to merge, or discard this patch.
src/Console/Command/VendorPublishCommand.php 1 patch
Braces   +22 added lines, -24 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
  * @package Platine\Framework\Console\Command
62 62
  * @template T
63 63
  */
64
-class VendorPublishCommand extends Command
65
-{
64
+class VendorPublishCommand extends Command {
66 65
     /**
67 66
      * Application instance
68 67
      * @var Application
@@ -109,7 +108,7 @@  discard block
 block discarded – undo
109 108
         Application $app,
110 109
         Filesystem $filesystem,
111 110
         Config $config
112
-    ) {
111
+    ) {
113 112
         parent::__construct(
114 113
             'vendor:publish',
115 114
             'Command to publish composer vendor configuration, migration, language etc.'
@@ -131,14 +130,13 @@  discard block
 block discarded – undo
131 130
     /**
132 131
      * {@inheritdoc}
133 132
      */
134
-    public function execute()
135
-    {
133
+    public function execute() {
136 134
         $writer = $this->io()->writer();
137 135
         $name = $this->getArgumentValue('name');
138 136
         $writer->boldGreen(sprintf('PUBLISH OF PACKAGE [%s]', $name), true)->eol();
139 137
 
140 138
         $package = $this->getPackageInfo($name);
141
-        if (empty($package)) {
139
+        if (empty($package)) {
142 140
             $writer->red(sprintf(
143 141
                 'Can not find the composer package [%s].',
144 142
                 $name
@@ -169,7 +167,7 @@  discard block
 block discarded – undo
169 167
         $extras = $package['extra'] ?? [];
170 168
         $manifest = $extras['platine'] ?? [];
171 169
 
172
-        if (empty($manifest)) {
170
+        if (empty($manifest)) {
173 171
             $writer->boldGreen('NOTHING TO PUBLISH, COMMAND ENDED!', true);
174 172
             return;
175 173
         }
@@ -189,28 +187,28 @@  discard block
 block discarded – undo
189 187
     protected function publishPackage(): void
190 188
     {
191 189
         $all = $this->getOptionValue('all');
192
-        if ($all) {
190
+        if ($all) {
193 191
             $this->publishAll();
194 192
             return;
195 193
         }
196 194
 
197 195
         $config = $this->getOptionValue('config');
198
-        if ($config) {
196
+        if ($config) {
199 197
             $this->publishConfiguration();
200 198
         }
201 199
 
202 200
         $migration = $this->getOptionValue('migration');
203
-        if ($migration) {
201
+        if ($migration) {
204 202
             $this->publishMigration();
205 203
         }
206 204
 
207 205
         $lang = $this->getOptionValue('lang');
208
-        if ($lang) {
206
+        if ($lang) {
209 207
             $this->publishLanguage();
210 208
         }
211 209
 
212 210
         $template = $this->getOptionValue('template');
213
-        if ($template) {
211
+        if ($template) {
214 212
             $this->publishTemplate();
215 213
         }
216 214
     }
@@ -242,7 +240,7 @@  discard block
 block discarded – undo
242 240
             $this->application->getConfigPath(),
243 241
             true
244 242
         );
245
-        foreach ($config as $cfg) {
243
+        foreach ($config as $cfg) {
246 244
             $this->publishItem($cfg, $destinationPath, 'configuration');
247 245
         }
248 246
     }
@@ -263,7 +261,7 @@  discard block
 block discarded – undo
263 261
 
264 262
         $manifest = $this->manifest;
265 263
         $languages = $manifest['lang'] ?? [];
266
-        foreach ($languages as $language) {
264
+        foreach ($languages as $language) {
267 265
             $this->publishItem($language, $destinationPath, 'language');
268 266
         }
269 267
     }
@@ -285,7 +283,7 @@  discard block
 block discarded – undo
285 283
 
286 284
         $manifest = $this->manifest;
287 285
         $migrations = $manifest['migration'] ?? [];
288
-        foreach ($migrations as $migration) {
286
+        foreach ($migrations as $migration) {
289 287
             $this->publishItem($migration, $destinationPath, 'migration');
290 288
         }
291 289
     }
@@ -307,7 +305,7 @@  discard block
 block discarded – undo
307 305
 
308 306
         $manifest = $this->manifest;
309 307
         $templates = $manifest['template'] ?? [];
310
-        foreach ($templates as $template) {
308
+        foreach ($templates as $template) {
311 309
             $this->publishItem($template, $destinationPath, 'template');
312 310
         }
313 311
     }
@@ -325,7 +323,7 @@  discard block
 block discarded – undo
325 323
 
326 324
         $sourcePath = $this->packagePath . '/' . $src;
327 325
         $asset = $this->filesystem->get($sourcePath);
328
-        if ($asset === null) {
326
+        if ($asset === null) {
329 327
             $writer->red(sprintf(
330 328
                 'Can not find the package file %s [%s].',
331 329
                 $type,
@@ -334,9 +332,9 @@  discard block
 block discarded – undo
334 332
             return;
335 333
         }
336 334
 
337
-        if ($asset instanceof DirectoryInterface) {
335
+        if ($asset instanceof DirectoryInterface) {
338 336
             $this->publishDirectory($asset, $dest);
339
-        } elseif ($asset instanceof FileInterface) {
337
+        } elseif ($asset instanceof FileInterface) {
340 338
             $this->publishFile($asset, $dest);
341 339
         }
342 340
 
@@ -366,13 +364,13 @@  discard block
 block discarded – undo
366 364
         $overwrite = $this->getOptionValue('overwrite');
367 365
 
368 366
         $writer = $this->io()->writer();
369
-        if ($destFile->exists() && !$overwrite) {
367
+        if ($destFile->exists() && !$overwrite) {
370 368
             $writer->red(sprintf(
371 369
                 "File [%s] already exist, if you want to overwrite"
372 370
                     . ' use option "--overwrite".',
373 371
                 $destFile->getPath()
374 372
             ), true);
375
-        } else {
373
+        } else {
376 374
             $file->copyTo($dest);
377 375
         }
378 376
     }
@@ -385,7 +383,7 @@  discard block
 block discarded – undo
385 383
      */
386 384
     protected function publishDirectory(DirectoryInterface $directory, string $dest): void
387 385
     {
388
-        foreach ($directory->read() as $item) {
386
+        foreach ($directory->read() as $item) {
389 387
             $item->copyTo($dest);
390 388
         }
391 389
     }
@@ -398,9 +396,9 @@  discard block
 block discarded – undo
398 396
     protected function getPackageInfo(string $name): array
399 397
     {
400 398
         $packages = Composer::parseLockFile($this->application->getRootPath());
401
-        foreach ($packages as $package) {
399
+        foreach ($packages as $package) {
402 400
             $packageName = $package['name'] ?? '';
403
-            if ($name === $packageName) {
401
+            if ($name === $packageName) {
404 402
                 return $package;
405 403
             }
406 404
         }
Please login to merge, or discard this patch.
src/Console/Command/MakeTaskCommand.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
     ) {
90 90
         parent::__construct($application, $filesystem);
91 91
         $this->setName('make:task')
92
-               ->setDescription('Command to generate new task class');
92
+                ->setDescription('Command to generate new task class');
93 93
     }
94 94
 
95 95
     /**
Please login to merge, or discard this patch.
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
  * @class MakeTaskCommand
60 60
  * @package Platine\Framework\Console\Command
61 61
  */
62
-class MakeTaskCommand extends MakeCommand
63
-{
62
+class MakeTaskCommand extends MakeCommand {
64 63
     /**
65 64
      * {@inheritdoc}
66 65
      */
@@ -86,7 +85,7 @@  discard block
 block discarded – undo
86 85
     public function __construct(
87 86
         Application $application,
88 87
         Filesystem $filesystem
89
-    ) {
88
+    ) {
90 89
         parent::__construct($application, $filesystem);
91 90
         $this->setName('make:task')
92 91
                ->setDescription('Command to generate new task class');
@@ -105,7 +104,7 @@  discard block
 block discarded – undo
105 104
 
106 105
 
107 106
         $expression = $io->prompt('Enter the cron expression', '* * * * *');
108
-        while (Cron::parse($expression) === 0) {
107
+        while (Cron::parse($expression) === 0) {
109 108
             $expression = $io->prompt('Invalid expression, please enter the cron expression', '* * * * *');
110 109
         }
111 110
         $this->expression = $expression;
@@ -114,14 +113,14 @@  discard block
 block discarded – undo
114 113
 
115 114
         $writer->boldYellow('Enter the properties list (empty value to finish):', true);
116 115
         $value = '';
117
-        while ($value !== null) {
116
+        while ($value !== null) {
118 117
             $value = $io->prompt('Property full class name', null, null, false);
119 118
 
120
-            if (!empty($value)) {
119
+            if (!empty($value)) {
121 120
                 $value = trim($value);
122
-                if (!class_exists($value) && !interface_exists($value)) {
121
+                if (!class_exists($value) && !interface_exists($value)) {
123 122
                     $writer->boldWhiteBgRed(sprintf('The class [%s] does not exists', $value), true);
124
-                } else {
123
+                } else {
125 124
                     $shortClass = $this->getClassBaseName($value);
126 125
                     $name = Str::camel($shortClass, true);
127 126
                     //replace"interface", "abstract"
Please login to merge, or discard this patch.
src/Console/Command/MakeResourceActionCommand.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     ) {
84 84
         parent::__construct($application, $filesystem);
85 85
         $this->setName('make:resource')
86
-              ->setDescription('Command to generate platine resource action');
86
+                ->setDescription('Command to generate platine resource action');
87 87
     }
88 88
 
89 89
     /**
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
         $this->addProperty($this->repositoryClass);
105 105
     }
106 106
 
107
-     /**
108
-     * {@inheritdoc}
109
-     */
107
+        /**
108
+         * {@inheritdoc}
109
+         */
110 110
     public function getClassTemplate(): string
111 111
     {
112 112
         return <<<EOF
Please login to merge, or discard this patch.
Braces   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
  * @class MakeResourceActionCommand
66 66
  * @package Platine\Framework\Console\Command
67 67
  */
68
-class MakeResourceActionCommand extends BaseMakeActionCommand
69
-{
68
+class MakeResourceActionCommand extends BaseMakeActionCommand {
70 69
     /**
71 70
      * {@inheritdoc}
72 71
      */
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
     public function __construct(
81 80
         Application $application,
82 81
         Filesystem $filesystem
83
-    ) {
82
+    ) {
84 83
         parent::__construct($application, $filesystem);
85 84
         $this->setName('make:resource')
86 85
               ->setDescription('Command to generate platine resource action');
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
 
96 95
         $baseClasses = $this->getBaseClasses();
97 96
 
98
-        foreach ($baseClasses as $value) {
97
+        foreach ($baseClasses as $value) {
99 98
             $this->addProperty($value);
100 99
         }
101 100
 
@@ -532,21 +531,21 @@  discard block
 block discarded – undo
532 531
         $templatePrefix = $this->getTemplatePrefix();
533 532
         $uniqueFields = $this->getOptionValue('fieldsUnique');
534 533
         $uniqueCheckStr = '';
535
-        if ($uniqueFields !== null) {
534
+        if ($uniqueFields !== null) {
536 535
             $duplicateMessage = $this->getMessage('messageDuplicate');
537 536
 
538 537
             $fields = (array) explode(',', $uniqueFields);
539 538
             $i = 1;
540 539
             $result = '';
541
-            foreach ($fields as $field) {
540
+            foreach ($fields as $field) {
542 541
                 $column = $field;
543 542
                 $param = $field;
544 543
                 $uniqueField = (array) explode(':', $field);
545
-                if (isset($uniqueField[0])) {
544
+                if (isset($uniqueField[0])) {
546 545
                     $column = $uniqueField[0];
547 546
                 }
548 547
 
549
-                if (isset($uniqueField[1])) {
548
+                if (isset($uniqueField[1])) {
550 549
                     $param = $uniqueField[1];
551 550
                 }
552 551
 
@@ -587,18 +586,18 @@  discard block
 block discarded – undo
587 586
         $result = '';
588 587
         $orderFields = $this->getOptionValue('fieldsOrder');
589 588
 
590
-        if ($orderFields !== null) {
589
+        if ($orderFields !== null) {
591 590
             $fields = (array) explode(',', $orderFields);
592 591
             $i = 1;
593
-            foreach ($fields as $field) {
592
+            foreach ($fields as $field) {
594 593
                 $column = $field;
595 594
                 $dir = 'ASC';
596 595
                 $orderField = (array) explode(':', $field);
597
-                if (isset($orderField[0])) {
596
+                if (isset($orderField[0])) {
598 597
                     $column = $orderField[0];
599 598
                 }
600 599
 
601
-                if (isset($orderField[1]) && in_array(strtolower($orderField[1]), ['asc', 'desc'])) {
600
+                if (isset($orderField[1]) && in_array(strtolower($orderField[1]), ['asc', 'desc'])) {
602 601
                     $dir = $orderField[1];
603 602
                 }
604 603
 
@@ -621,19 +620,19 @@  discard block
 block discarded – undo
621 620
     {
622 621
         $fields = $this->getOptionValue('fields');
623 622
         $result = '';
624
-        if ($fields !== null) {
623
+        if ($fields !== null) {
625 624
             $fields = (array) explode(',', $fields);
626 625
             $i = 1;
627 626
 
628
-            foreach ($fields as $field) {
627
+            foreach ($fields as $field) {
629 628
                 $column = $field;
630 629
                 $param = $field;
631 630
                 $entityField = (array) explode(':', $field);
632
-                if (isset($entityField[0])) {
631
+                if (isset($entityField[0])) {
633 632
                     $column = $entityField[0];
634 633
                 }
635 634
 
636
-                if (isset($entityField[1])) {
635
+                if (isset($entityField[1])) {
637 636
                     $param = $entityField[1];
638 637
                 }
639 638
 
@@ -693,7 +692,7 @@  discard block
 block discarded – undo
693 692
         $create = true
694 693
     ): string {
695 694
         $fieldMethodName = $this->getFormParamMethodName($param);
696
-        if ($create) {
695
+        if ($create) {
697 696
             return sprintf('\'%s\' => $formParam->%s(),', $field, $fieldMethodName) . ($isLast ? PHP_EOL : '');
698 697
         }
699 698
         $entityContextName = $this->getEntityContextKey(false);
Please login to merge, or discard this patch.
src/Console/Command/MakeEntityCommand.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
     ) {
94 94
         parent::__construct($application, $filesystem);
95 95
         $this->setName('make:entity')
96
-               ->setDescription('Command to generate new entity class');
96
+                ->setDescription('Command to generate new entity class');
97 97
     }
98 98
 
99 99
     /**
Please login to merge, or discard this patch.
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @class MakeEntityCommand
58 58
  * @package Platine\Framework\Console\Command
59 59
  */
60
-class MakeEntityCommand extends MakeCommand
61
-{
60
+class MakeEntityCommand extends MakeCommand {
62 61
     /**
63 62
      * {@inheritdoc}
64 63
      */
@@ -90,7 +89,7 @@  discard block
 block discarded – undo
90 89
     public function __construct(
91 90
         Application $application,
92 91
         Filesystem $filesystem
93
-    ) {
92
+    ) {
94 93
         parent::__construct($application, $filesystem);
95 94
         $this->setName('make:entity')
96 95
                ->setDescription('Command to generate new entity class');
@@ -108,7 +107,7 @@  discard block
 block discarded – undo
108 107
 
109 108
         $this->useTimestamp = $io->confirm('Use timestamp feature', 'y');
110 109
 
111
-        if ($this->useTimestamp) {
110
+        if ($this->useTimestamp) {
112 111
             $this->createdAtField = $io->prompt('Created at field name', 'created_at');
113 112
             $this->upatedAtField = $io->prompt('Updated at field name', 'updated_at');
114 113
         }
@@ -170,9 +169,9 @@  discard block
 block discarded – undo
170 169
     protected function getMapperBody(string $content): string
171 170
     {
172 171
         $result = '';
173
-        if ($this->useTimestamp) {
172
+        if ($this->useTimestamp) {
174 173
             $useTimestamp = 'useTimestamp()';
175
-            if ($this->createdAtField !== 'created_at' || $this->upatedAtField !== 'updated_at') {
174
+            if ($this->createdAtField !== 'created_at' || $this->upatedAtField !== 'updated_at') {
176 175
                 $useTimestamp = sprintf(
177 176
                     'useTimestamp(true, \'%s\', \'%s\')',
178 177
                     $this->createdAtField,
Please login to merge, or discard this patch.