Test Failed
Push — develop ( 70abbc...8213ee )
by nguereza
02:59
created
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.
src/Console/MakeCommand.php 1 patch
Braces   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
  * @class MakeCommand
57 57
  * @package Platine\Framework\Console
58 58
  */
59
-abstract class MakeCommand extends BaseCommand
60
-{
59
+abstract class MakeCommand extends BaseCommand {
61 60
     /**
62 61
      * The type of class
63 62
      * @var string
@@ -84,7 +83,7 @@  discard block
 block discarded – undo
84 83
     public function __construct(
85 84
         Application $application,
86 85
         Filesystem $filesystem
87
-    ) {
86
+    ) {
88 87
         parent::__construct($application, $filesystem);
89 88
         $this->addArgument('name', 'The full class name (without the root namespace)', null, false);
90 89
         $this->addOption('-f|--force', 'Overwrite existing files.', false, false);
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
     /**
94 93
      * {@inheritdoc}
95 94
      */
96
-    public function execute()
97
-    {
95
+    public function execute() {
98 96
         $io = $this->io();
99 97
         $writer = $io->writer();
100 98
         $name = $this->className;
@@ -110,7 +108,7 @@  discard block
 block discarded – undo
110 108
         ), true)->eol();
111 109
 
112 110
 
113
-        if ($this->fileExists($name) && !$this->getOptionValue('force')) {
111
+        if ($this->fileExists($name) && !$this->getOptionValue('force')) {
114 112
             $writer->red(sprintf(
115 113
                 'File [%s] already exists.',
116 114
                 $path
@@ -128,7 +126,7 @@  discard block
 block discarded – undo
128 126
         $writer->bold('Namespace: ');
129 127
         $writer->boldBlueBgBlack($namespace, true);
130 128
 
131
-        if ($io->confirm(sprintf('Are you confirm the generation of [%s] ?', $className), 'y')) {
129
+        if ($io->confirm(sprintf('Are you confirm the generation of [%s] ?', $className), 'y')) {
132 130
             $this->createParentDirectory($path);
133 131
             $content = $this->createClass();
134 132
 
@@ -145,7 +143,7 @@  discard block
 block discarded – undo
145 143
     {
146 144
         $writer->boldYellow('GENERATION OF NEW CLASS', true)->eol();
147 145
         $name = $this->getArgumentValue('name');
148
-        if (empty($name)) {
146
+        if (empty($name)) {
149 147
             $io = $this->io();
150 148
             $name = $io->prompt('Enter the full class name (can include root namespace)', null);
151 149
         }
@@ -255,13 +253,13 @@  discard block
 block discarded – undo
255 253
      */
256 254
     protected function getPropertiesContent(): string
257 255
     {
258
-        if (empty($this->properties)) {
256
+        if (empty($this->properties)) {
259 257
             return '';
260 258
         }
261 259
 
262 260
         $content = '';
263 261
 
264
-        foreach ($this->properties as $className => $info) {
262
+        foreach ($this->properties as $className => $info) {
265 263
             $content .= $this->getPropertyTemplate($className, $info);
266 264
         }
267 265
 
@@ -274,13 +272,13 @@  discard block
 block discarded – undo
274 272
      */
275 273
     protected function getUsesContent(): string
276 274
     {
277
-        if (empty($this->properties)) {
275
+        if (empty($this->properties)) {
278 276
             return '';
279 277
         }
280 278
 
281 279
         $content = '';
282 280
 
283
-        foreach ($this->properties as $className => $info) {
281
+        foreach ($this->properties as $className => $info) {
284 282
             $content .= $this->getUsesTemplate($className);
285 283
         }
286 284
 
@@ -294,7 +292,7 @@  discard block
 block discarded – undo
294 292
      */
295 293
     protected function getConstructorContent(): string
296 294
     {
297
-        if (empty($this->properties)) {
295
+        if (empty($this->properties)) {
298 296
             return '';
299 297
         }
300 298
 
@@ -329,7 +327,7 @@  discard block
 block discarded – undo
329 327
     protected function getConstructorDocBlockContent(): string
330 328
     {
331 329
         $content = '';
332
-        foreach ($this->properties as $className => $info) {
330
+        foreach ($this->properties as $className => $info) {
333 331
             $content .= $this->getConstructorDocBlockTemplate($className, $info);
334 332
         }
335 333
 
@@ -349,7 +347,7 @@  discard block
 block discarded – undo
349 347
         $content = '';
350 348
         $i = 1;
351 349
         $count = count($this->properties);
352
-        foreach ($this->properties as $className => $info) {
350
+        foreach ($this->properties as $className => $info) {
353 351
             $content .= $this->getConstructorParamsTemplate($className, $info, $i === $count);
354 352
             $i++;
355 353
         }
@@ -366,7 +364,7 @@  discard block
 block discarded – undo
366 364
         $content = '';
367 365
         $i = 1;
368 366
         $count = count($this->properties);
369
-        foreach ($this->properties as $className => $info) {
367
+        foreach ($this->properties as $className => $info) {
370 368
             $content .= $this->getConstructorBodyTemplate($className, $info, $i === $count);
371 369
             $i++;
372 370
         }
@@ -407,7 +405,7 @@  discard block
 block discarded – undo
407 405
         $name = $info['name'];
408 406
         $comma = $isLast ? '' : ',';
409 407
 
410
-        if ($isLast) {
408
+        if ($isLast) {
411 409
             return <<<EOF
412 410
             $shortClass \$$name$comma
413 411
             EOF;
@@ -430,7 +428,7 @@  discard block
 block discarded – undo
430 428
     {
431 429
         $name = $info['name'];
432 430
 
433
-        if ($isLast) {
431
+        if ($isLast) {
434 432
             return <<<EOF
435 433
             \$this->$name = \$$name;
436 434
             EOF;
Please login to merge, or discard this patch.
src/Console/BaseMakeActionCommand.php 1 patch
Braces   +32 added lines, -33 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
  * @class BaseMakeActionCommand
60 60
  * @package Platine\Framework\Console
61 61
  */
62
-abstract class BaseMakeActionCommand extends MakeCommand
63
-{
62
+abstract class BaseMakeActionCommand extends MakeCommand {
64 63
     /**
65 64
      * The form parameter class name
66 65
      * @var class-string
@@ -93,7 +92,7 @@  discard block
 block discarded – undo
93 92
     public function __construct(
94 93
         Application $application,
95 94
         Filesystem $filesystem
96
-    ) {
95
+    ) {
97 96
         parent::__construct($application, $filesystem);
98 97
 
99 98
         $this->addOption(
@@ -213,14 +212,14 @@  discard block
 block discarded – undo
213 212
 
214 213
         $writer->boldYellow('Enter the properties list (empty value to finish):', true);
215 214
         $value = '';
216
-        while ($value !== null) {
215
+        while ($value !== null) {
217 216
             $value = $io->prompt('Property full class name', null, null, false);
218 217
 
219
-            if (!empty($value)) {
218
+            if (!empty($value)) {
220 219
                 $value = trim($value);
221
-                if (!class_exists($value) && !interface_exists($value)) {
220
+                if (!class_exists($value) && !interface_exists($value)) {
222 221
                     $writer->boldWhiteBgRed(sprintf('The class [%s] does not exists', $value), true);
223
-                } else {
222
+                } else {
224 223
                     $shortClass = $this->getClassBaseName($value);
225 224
                     $name = Str::camel($shortClass, true);
226 225
                     //replace"interface", "abstract"
@@ -244,14 +243,14 @@  discard block
 block discarded – undo
244 243
         $io = $this->io();
245 244
 
246 245
         $paramClass = $io->prompt('Enter the form parameter full class name', null);
247
-        while (!class_exists($paramClass)) {
246
+        while (!class_exists($paramClass)) {
248 247
             $paramClass = $io->prompt('Class does not exists, please enter the form parameter full class name', null);
249 248
         }
250 249
 
251 250
         $this->paramClass = $paramClass;
252 251
 
253 252
         $validatorClass = $io->prompt('Enter the form validator full class name', null);
254
-        while (!class_exists($validatorClass)) {
253
+        while (!class_exists($validatorClass)) {
255 254
             $validatorClass = $io->prompt(
256 255
                 'Class does not exists, please enter the form validator full class name',
257 256
                 null
@@ -261,14 +260,14 @@  discard block
 block discarded – undo
261 260
         $this->validatorClass = $validatorClass;
262 261
 
263 262
         $entityClass = $io->prompt('Enter the entity full class name', null);
264
-        while (!class_exists($entityClass)) {
263
+        while (!class_exists($entityClass)) {
265 264
             $entityClass = $io->prompt('Class does not exists, please enter the entity full class name', null);
266 265
         }
267 266
 
268 267
         $this->entityClass = $entityClass;
269 268
 
270 269
         $repositoryClass = $io->prompt('Enter the repository full class name', null);
271
-        while (!class_exists($repositoryClass)) {
270
+        while (!class_exists($repositoryClass)) {
272 271
             $repositoryClass = $io->prompt('Class does not exists, please enter the repository full class name', null);
273 272
         }
274 273
 
@@ -284,7 +283,7 @@  discard block
 block discarded – undo
284 283
     protected function addProperty(string $value, ?string $name = null): self
285 284
     {
286 285
         $shortClass = $this->getClassBaseName($value);
287
-        if ($name === null) {
286
+        if ($name === null) {
288 287
             $name = Str::camel($shortClass, true);
289 288
         }
290 289
 
@@ -306,7 +305,7 @@  discard block
 block discarded – undo
306 305
      */
307 306
     protected function getPropertyName(string $value): string
308 307
     {
309
-        if (!isset($this->properties[$value])) {
308
+        if (!isset($this->properties[$value])) {
310 309
             return '';
311 310
         }
312 311
 
@@ -321,7 +320,7 @@  discard block
 block discarded – undo
321 320
     protected function getTemplatePrefix(): string
322 321
     {
323 322
         $templatePrefix = $this->getOptionValue('templatePrefix');
324
-        if ($templatePrefix === null) {
323
+        if ($templatePrefix === null) {
325 324
             $actionName = $this->getShortClassName($this->className);
326 325
             $templatePrefix = Str::snake(str_ireplace('action', '', $actionName));
327 326
         }
@@ -337,10 +336,10 @@  discard block
 block discarded – undo
337 336
     protected function getEntityContextKey(bool $isKey = true): string
338 337
     {
339 338
         $key = (string) $this->getOptionValue('entityContextKey');
340
-        if (!empty($key)) {
341
-            if ($isKey) {
339
+        if (!empty($key)) {
340
+            if ($isKey) {
342 341
                 $key = Str::snake($key, '_');
343
-            } else {
342
+            } else {
344 343
                 $key = Str::camel($key, true);
345 344
             }
346 345
         }
@@ -355,7 +354,7 @@  discard block
 block discarded – undo
355 354
     protected function getRoutePrefix(): string
356 355
     {
357 356
         $routePrefix = $this->getOptionValue('routePrefix');
358
-        if ($routePrefix === null) {
357
+        if ($routePrefix === null) {
359 358
             $actionName = $this->getShortClassName($this->className);
360 359
             $routePrefix = Str::snake(str_ireplace('action', '', $actionName));
361 360
         }
@@ -392,7 +391,7 @@  discard block
 block discarded – undo
392 391
     protected function getMessage(string $option): ?string
393 392
     {
394 393
         $message = (string) $this->getOptionValue($option);
395
-        if (!empty($message)) {
394
+        if (!empty($message)) {
396 395
             $message = addslashes($message);
397 396
         }
398 397
 
@@ -424,15 +423,15 @@  discard block
 block discarded – undo
424 423
     {
425 424
         $result = [];
426 425
         $fields = (array) explode(',', $values);
427
-        foreach ($fields as $field) {
426
+        foreach ($fields as $field) {
428 427
             $column = $field;
429 428
             $param = $field;
430 429
             $value = (array) explode(':', $field);
431
-            if (isset($value[0])) {
430
+            if (isset($value[0])) {
432 431
                 $column = $value[0];
433 432
             }
434 433
 
435
-            if (isset($value[1])) {
434
+            if (isset($value[1])) {
436 435
                 $param = $value[1];
437 436
             }
438 437
 
@@ -451,23 +450,23 @@  discard block
 block discarded – undo
451 450
     protected function formatFieldStr(array $fields, bool $orderField = false): string
452 451
     {
453 452
         $result = '';
454
-        foreach ($fields as $field => $param) {
455
-            if ($orderField) {
453
+        foreach ($fields as $field => $param) {
454
+            if ($orderField) {
456 455
                 $param = Str::upper($param);
457 456
                 $order = 'ASC';
458
-                if ($param === 'DESC') {
457
+                if ($param === 'DESC') {
459 458
                     $order = 'DESC';
460 459
                 }
461 460
 
462
-                if ($order === 'ASC') {
461
+                if ($order === 'ASC') {
463 462
                     $result .= sprintf('\'%s\', ', $field);
464
-                } else {
463
+                } else {
465 464
                     $result .= sprintf('\'%s\' => \'DESC\', ', $field);
466 465
                 }
467
-            } else {
468
-                if ($field === $param) {
466
+            } else {
467
+                if ($field === $param) {
469 468
                     $result .= sprintf('\'%s\', ', $field);
470
-                } else {
469
+                } else {
471 470
                     $result .= sprintf('\'%s\' => \'%s\', ', $field, $param);
472 471
                 }
473 472
             }
@@ -483,13 +482,13 @@  discard block
 block discarded – undo
483 482
     protected function loadConfig(): void
484 483
     {
485 484
         $filename = $this->getOptionValue('config');
486
-        if (!empty($filename)) {
485
+        if (!empty($filename)) {
487 486
             $file = $this->filesystem->file($filename);
488
-            if ($file->exists() && $file->isReadable()) {
487
+            if ($file->exists() && $file->isReadable()) {
489 488
                 $content = $file->read();
490 489
                 /** @var array<string, string> $config */
491 490
                 $config = Json::decode($content, true);
492
-                foreach ($config as $option => $value) {
491
+                foreach ($config as $option => $value) {
493 492
                     $optionKey = Str::camel($option, true);
494 493
                     $this->values[$optionKey] = $value;
495 494
                 }
Please login to merge, or discard this patch.
src/Console/PasswordGenerateCommand.php 1 patch
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
  * @class PasswordGenerateCommand
57 57
  * @package Platine\Framework\Console
58 58
  */
59
-class PasswordGenerateCommand extends Command
60
-{
59
+class PasswordGenerateCommand extends Command {
61 60
     /**
62 61
      * The Hash instance
63 62
      * @var HashInterface
@@ -76,7 +75,7 @@  discard block
 block discarded – undo
76 75
      */
77 76
     public function __construct(
78 77
         HashInterface $hash
79
-    ) {
78
+    ) {
80 79
         parent::__construct('password:generate', 'Command to generate password');
81 80
         $this->hash = $hash;
82 81
         $this->addArgument('password', 'The password to hash', null, false);
@@ -85,8 +84,7 @@  discard block
 block discarded – undo
85 84
     /**
86 85
      * {@inheritdoc}
87 86
      */
88
-    public function execute()
89
-    {
87
+    public function execute() {
90 88
         $io = $this->io();
91 89
         $writer = $io->writer();
92 90
         $password = $this->password;
@@ -109,7 +107,7 @@  discard block
 block discarded – undo
109 107
     {
110 108
         $writer->boldYellow('GENERATION OF PASSWORD', true)->eol();
111 109
         $password = $this->getArgumentValue('password');
112
-        if (empty($password)) {
110
+        if (empty($password)) {
113 111
             $io = $this->io();
114 112
             $password = $io->prompt('Enter the plain password to generate', '');
115 113
         }
Please login to merge, or discard this patch.
src/Pagination/ServerRequestUrlGenerator.php 1 patch
Braces   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class ServerRequestUrlGenerator
55 55
  * @package Platine\Framework\Pagination
56 56
  */
57
-class ServerRequestUrlGenerator implements UrlGeneratorInterface
58
-{
57
+class ServerRequestUrlGenerator implements UrlGeneratorInterface {
59 58
     /**
60 59
      * The server request instance
61 60
      * @var ServerRequestInterface
@@ -79,8 +78,7 @@  discard block
 block discarded – undo
79 78
      * @param ServerRequestInterface $request
80 79
      * @param string $queryName
81 80
      */
82
-    public function __construct(ServerRequestInterface $request, string $queryName)
83
-    {
81
+    public function __construct(ServerRequestInterface $request, string $queryName) {
84 82
         $this->request = $request;
85 83
         $this->queryVarName = $queryName;
86 84
 
@@ -114,18 +112,18 @@  discard block
 block discarded – undo
114 112
         $page = $this->queryVarName;
115 113
 
116 114
         $query = '';
117
-        if (empty($queryString)) {
115
+        if (empty($queryString)) {
118 116
             $query = sprintf('?%s={num}', $page);
119
-        } else {
117
+        } else {
120 118
             $parts = explode($page . '=', $queryString);
121 119
             $count = count($parts);
122 120
 
123
-            if ($count === 1) {
121
+            if ($count === 1) {
124 122
                 $query = sprintf('?%s&%s={num}', $queryString, $page);
125
-            } else {
126
-                if (empty($parts[0])) {
123
+            } else {
124
+                if (empty($parts[0])) {
127 125
                     $query = sprintf('?%s={num}', $page);
128
-                } else {
126
+                } else {
129 127
                     $query = sprintf('?%s%s={num}', $parts[0], $page);
130 128
                 }
131 129
             }
Please login to merge, or discard this patch.