Passed
Push — master ( 45960c...20d4cd )
by Glegrith
01:58
created
app/framework/Component/Validation/Validators/Password.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
         return 'password';
19 19
     }
20 20
 
21
-    public function validate($value, $params = [], $throw = false)
21
+    public function validate($value, $params = [ ], $throw = false)
22 22
     {
23
-        $isDevPassword = in_array($value, ['dev', 'admin']);
23
+        $isDevPassword = in_array($value, [ 'dev', 'admin' ]);
24 24
         $isFullyValid = preg_match_all("/^.*(?=.{8,})(?=.*[a-zA-Z])(?=.*\\d).*$/", $value);
25 25
 
26 26
         if ($isDevPassword || $isFullyValid) {
Please login to merge, or discard this patch.
app/framework/Component/Validation/Validators/LessThanOrEqual.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@
 block discarded – undo
32 32
      *
33 33
      * @return boolean|string
34 34
      */
35
-    public function validate($value, $params = [], $throw = true)
35
+    public function validate($value, $params = [ ], $throw = true)
36 36
     {
37
-        $cmp = $params[0];
38
-        if($value <= $cmp){
37
+        $cmp = $params[ 0 ];
38
+        if ($value <= $cmp) {
39 39
             return true;
40 40
         }
41 41
 
42 42
         $message = "Value must be less than or equal %s";
43
-        if($throw){
43
+        if ($throw) {
44 44
             throw (new ValidationException($message, $cmp));
45 45
         }
46 46
 
Please login to merge, or discard this patch.
app/framework/Component/Validation/Validators/GeoLocation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
      *
33 33
      * @return boolean|string
34 34
      */
35
-    public function validate($value, $params = [], $throw = true)
35
+    public function validate($value, $params = [ ], $throw = true)
36 36
     {
37
-        if (is_array($value) && isset($value['lat']) && isset($value['lng'])) {
37
+        if (is_array($value) && isset($value[ 'lat' ]) && isset($value[ 'lng' ])) {
38 38
             return true;
39 39
         }
40 40
 
Please login to merge, or discard this patch.
app/framework/Component/Console/Kernel.php 2 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $this->init();
173 173
 
174
-        return isset($this->commands[$name]) || $this->commandLoader->has($name);
174
+        return isset($this->commands[ $name ]) || $this->commandLoader->has($name);
175 175
     }
176 176
 
177 177
     /**
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $this->init();
189 189
 
190
-        if(!$this->has($name) && $this->commandLoader->has($name)) {
190
+        if (!$this->has($name) && $this->commandLoader->has($name)) {
191 191
             throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
192 192
         }
193 193
 
194
-        if(isset($this->commands[$name])) {
195
-            return $this->commands[$name];
194
+        if (isset($this->commands[ $name ])) {
195
+            return $this->commands[ $name ];
196 196
         }
197 197
 
198 198
         return $this->commandLoader->get($name);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 
279 279
             $commands = array();
280 280
             foreach ($this->commandLoader->getNames() as $name) {
281
-                if (!isset($commands[$name]) && $this->has($name)) {
282
-                    $commands[$name] = $this->get($name);
281
+                if (!isset($commands[ $name ]) && $this->has($name)) {
282
+                    $commands[ $name ] = $this->get($name);
283 283
                 }
284 284
             }
285 285
 
@@ -289,20 +289,20 @@  discard block
 block discarded – undo
289 289
         $commands = array();
290 290
         foreach ($this->commands as $name => $command) {
291 291
             if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
292
-                $commands[$name] = $command;
292
+                $commands[ $name ] = $command;
293 293
             }
294 294
         }
295 295
 
296 296
         if ($this->commandLoader) {
297 297
             foreach ($this->commandLoader->getNames() as $name) {
298
-                if (!isset($commands[$name])
298
+                if (!isset($commands[ $name ])
299 299
                     && $namespace === $this->extractNamespace(
300 300
                         $name,
301 301
                         substr_count($namespace, ':') + 1
302 302
                     )
303 303
                     && $this->has($name)
304 304
                 ) {
305
-                    $commands[$name] = $this->get($name);
305
+                    $commands[ $name ] = $this->get($name);
306 306
                 }
307 307
             }
308 308
         }
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
         $allNamespaces = $this->getNamespaces();
343 343
         $expr          = preg_replace_callback(
344 344
             '{([^:]+|)}',
345
-            function ($matches) {
346
-                return preg_quote($matches[1]).'[^:]*';
345
+            function($matches) {
346
+                return preg_quote($matches[ 1 ]).'[^:]*';
347 347
             },
348 348
             $namespace
349 349
         );
350
-        $namespaces    = preg_grep('{^'.$expr.'}', $allNamespaces);
350
+        $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
351 351
 
352 352
         if (empty($namespaces)) {
353 353
             $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
@@ -462,29 +462,29 @@  discard block
 block discarded – undo
462 462
      */
463 463
     private function getDefaultCommands()
464 464
     {
465
-        $classes = [];
465
+        $classes = [ ];
466 466
         $excludeClass = "app\\framework\\Component\\Console\\Command\\Command";
467 467
 
468 468
         // Go through all registered namespaces and get all classes inside.
469 469
         // Create instance of classes and put it in array if
470 470
         // its not the Command class and its an instance of it.
471 471
         foreach ($this->defaultNamespaces as $namespace) {
472
-            $path = str_replace("\\","/", $namespace);
472
+            $path = str_replace("\\", "/", $namespace);
473 473
             $filesInNamespace = new ArrayObject(scandir(ROOT_PATH."/".$path."/"));
474 474
             $filesInNamespace->removeFirst()->removeFirst();
475 475
 
476
-            for ($i = 0; $i <= $filesInNamespace->count()-1; $i++) {
477
-                $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[0]);
476
+            for ($i = 0; $i <= $filesInNamespace->count() - 1; $i++) {
477
+                $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[ 0 ]);
478 478
             }
479 479
 
480 480
             foreach ($filesInNamespace->val() as $value) {
481 481
                 $class = $namespace.$value;
482
-                if(
482
+                if (
483 483
                     class_exists($class)
484 484
                     && $class != $excludeClass
485 485
                     && is_subclass_of($class, $excludeClass)
486 486
                 )
487
-                    $classes[] = new $class();
487
+                    $classes[ ] = new $class();
488 488
             }
489 489
         }
490 490
 
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 
524 524
         foreach ($parts as $part) {
525 525
             if (count($namespaces)) {
526
-                $namespaces[] = end($namespaces).':'.$part;
526
+                $namespaces[ ] = end($namespaces).':'.$part;
527 527
             } else {
528
-                $namespaces[] = $part;
528
+                $namespaces[ ] = $part;
529 529
             }
530 530
         }
531 531
 
@@ -548,30 +548,30 @@  discard block
 block discarded – undo
548 548
         $collectionParts = array();
549 549
 
550 550
         foreach ($collection as $item) {
551
-            $collectionParts[$item] = explode(':', $item);
551
+            $collectionParts[ $item ] = explode(':', $item);
552 552
         }
553 553
 
554 554
         foreach (explode(':', $name) as $i => $subname) {
555 555
             foreach ($collectionParts as $collectionName => $parts) {
556
-                $exists = isset($alternatives[$collectionName]);
556
+                $exists = isset($alternatives[ $collectionName ]);
557 557
 
558
-                if (!isset($parts[$i]) && $exists) {
559
-                    $alternatives[$collectionName] += $threshold;
558
+                if (!isset($parts[ $i ]) && $exists) {
559
+                    $alternatives[ $collectionName ] += $threshold;
560 560
                     continue;
561
-                } elseif (!isset($parts[$i])) {
561
+                } elseif (!isset($parts[ $i ])) {
562 562
                     continue;
563 563
                 }
564 564
 
565
-                $lev = levenshtein($subname, $parts[$i]);
565
+                $lev = levenshtein($subname, $parts[ $i ]);
566 566
 
567 567
                 if ($lev <= strlen($subname) / 3 || '' !== $subname
568
-                    && false !== strpos($parts[$i], $subname)
568
+                    && false !== strpos($parts[ $i ], $subname)
569 569
                 ) {
570
-                    $alternatives[$collectionName] = $exists
571
-                        ? $alternatives[$collectionName] + $lev
570
+                    $alternatives[ $collectionName ] = $exists
571
+                        ? $alternatives[ $collectionName ] + $lev
572 572
                         : $lev;
573 573
                 } elseif ($exists) {
574
-                    $alternatives[$collectionName] += $threshold;
574
+                    $alternatives[ $collectionName ] += $threshold;
575 575
                 }
576 576
             }
577 577
         }
@@ -580,11 +580,11 @@  discard block
 block discarded – undo
580 580
             $lev = levenshtein($name, $item);
581 581
 
582 582
             if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
583
-                $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
583
+                $alternatives[ $item ] = isset($alternatives[ $item ]) ? $alternatives[ $item ] - $lev : $lev;
584 584
             }
585 585
         }
586 586
 
587
-        $alternatives = array_filter($alternatives, function ($lev) use ($threshold) {
587
+        $alternatives = array_filter($alternatives, function($lev) use ($threshold) {
588 588
             return $lev < 2 * $threshold;
589 589
         });
590 590
         ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
             }
615 615
 
616 616
             // if not, push current line to array and make new line
617
-            $lines[] = str_pad($line, $width);
617
+            $lines[ ] = str_pad($line, $width);
618 618
             $line = $char;
619 619
         }
620 620
 
621
-        $lines[] = count($lines) ? str_pad($line, $width) : $line;
621
+        $lines[ ] = count($lines) ? str_pad($line, $width) : $line;
622 622
         mb_convert_variables($encoding, 'utf8', $lines);
623 623
 
624 624
         return $lines;
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
                 foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
654 654
                     // pre-format lines to get the right string length
655 655
                     $lineLength = Helper::strlen($line) + 4;
656
-                    $lines[] = array($line, $lineLength);
656
+                    $lines[ ] = array($line, $lineLength);
657 657
                     $len = max($lineLength, $len);
658 658
                 }
659 659
             }
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
             if (!$e instanceof ExceptionInterface
664 664
                 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity())
665 665
             {
666
-                $messages[] = sprintf(
666
+                $messages[ ] = sprintf(
667 667
                     '<comment>%s</comment>',
668 668
                     OutputFormatter::escape(
669 669
                         sprintf(
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
                 );
676 676
             }
677 677
 
678
-            $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
678
+            $messages[ ] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
679 679
 
680 680
             if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
681
-                $messages[] = sprintf(
681
+                $messages[ ] = sprintf(
682 682
                     '<error>%s%s</error>',
683 683
                     $title, str_repeat(
684 684
                         ' ',
@@ -688,15 +688,15 @@  discard block
 block discarded – undo
688 688
             }
689 689
 
690 690
             foreach ($lines as $line) {
691
-                $messages[] = sprintf(
691
+                $messages[ ] = sprintf(
692 692
                     '<error>  %s  %s</error>',
693
-                    OutputFormatter::escape($line[0]),
694
-                    str_repeat(' ', $len - $line[1])
693
+                    OutputFormatter::escape($line[ 0 ]),
694
+                    str_repeat(' ', $len - $line[ 1 ])
695 695
                 );
696 696
             }
697 697
 
698
-            $messages[] = $emptyLine;
699
-            $messages[] = '';
698
+            $messages[ ] = $emptyLine;
699
+            $messages[ ] = '';
700 700
             $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
701 701
 
702 702
             if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
                 $trace = $e->getTrace();
709 709
 
710 710
                 for ($i = 0, $count = count($trace); $i < $count; ++$i) {
711
-                    $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
712
-                    $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
713
-                    $function = $trace[$i]['function'];
714
-                    $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
715
-                    $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
711
+                    $class = isset($trace[ $i ][ 'class' ]) ? $trace[ $i ][ 'class' ] : '';
712
+                    $type = isset($trace[ $i ][ 'type' ]) ? $trace[ $i ][ 'type' ] : '';
713
+                    $function = $trace[ $i ][ 'function' ];
714
+                    $file = isset($trace[ $i ][ 'file' ]) ? $trace[ $i ][ 'file' ] : 'n/a';
715
+                    $line = isset($trace[ $i ][ 'line' ]) ? $trace[ $i ][ 'line' ] : 'n/a';
716 716
                     $output->writeln(
717 717
                         sprintf(
718 718
                             ' %s%s%s() at <info>%s:%s</info>',
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
         }
798 798
 
799 799
         putenv('SHELL_VERBOSITY='.$shellVerbosity);
800
-        $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
801
-        $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
800
+        $_ENV[ 'SHELL_VERBOSITY' ] = $shellVerbosity;
801
+        $_SERVER[ 'SHELL_VERBOSITY' ] = $shellVerbosity;
802 802
     }
803 803
 
804 804
     /**
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -273,8 +273,9 @@  discard block
 block discarded – undo
273 273
         $this->init();
274 274
 
275 275
         if ($namespace == null) {
276
-            if (!$this->commandLoader)
277
-                return $this->commands;
276
+            if (!$this->commandLoader) {
277
+                            return $this->commands;
278
+            }
278 279
 
279 280
             $commands = array();
280 281
             foreach ($this->commandLoader->getNames() as $name) {
@@ -364,14 +365,15 @@  discard block
 block discarded – undo
364 365
         }
365 366
 
366 367
         $exact = in_array($namespace, $namespaces, true);
367
-        if (count($namespaces) > 1 && !$exact)
368
-            throw new NamespaceNotFoundException(
368
+        if (count($namespaces) > 1 && !$exact) {
369
+                    throw new NamespaceNotFoundException(
369 370
                 sprintf(
370 371
                     "The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s",
371 372
                     $namespace,
372 373
                     $this->getAbbreviationSuggestions(array_values($namespaces))),
373 374
                 array_values($namespaces)
374 375
             );
376
+        }
375 377
 
376 378
         return $exact ? $namespace : reset($namespaces);
377 379
     }
@@ -483,8 +485,9 @@  discard block
 block discarded – undo
483 485
                     class_exists($class)
484 486
                     && $class != $excludeClass
485 487
                     && is_subclass_of($class, $excludeClass)
486
-                )
487
-                    $classes[] = new $class();
488
+                ) {
489
+                                    $classes[] = new $class();
490
+                }
488 491
             }
489 492
         }
490 493
 
Please login to merge, or discard this patch.
app/framework/Component/Console/CommandLoader/CommandLoader.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class CommandLoader implements CommandLoaderInterface
15 15
 {
16
-    private $registeredCommands = [];
16
+    private $registeredCommands = [ ];
17 17
 
18 18
     private $defaultCommandPaths = [
19 19
         ROOT_PATH.'/app/custom/Commands'
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
     {
27 27
         // load Commands from default paths
28 28
         try {
29
-            foreach($this->defaultCommandPaths as $directory) {
29
+            foreach ($this->defaultCommandPaths as $directory) {
30 30
                 $files = glob($directory.'/*.php');
31
-                foreach($files as $file) {
31
+                foreach ($files as $file) {
32 32
                     $this->registerByPath($file);
33 33
                 }
34 34
             }
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function get($name)
48 48
     {
49
-        if($this->has($name)) {
50
-            return $this->registeredCommands[$name];
49
+        if ($this->has($name)) {
50
+            return $this->registeredCommands[ $name ];
51 51
         } else {
52 52
             throw new CommandNotFoundException(sprintf('Command "%s" not found', $name));
53 53
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function has($name)
63 63
     {
64
-        return isset($this->registeredCommands[$name]);
64
+        return isset($this->registeredCommands[ $name ]);
65 65
     }
66 66
 
67 67
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $command = $this->load($path);
84 84
 
85
-        if($command) {
85
+        if ($command) {
86 86
             $this->register($command);
87 87
         } else {
88 88
             throw new CommandNotFoundException("Can't find a fucking command.");
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function add(Command $command)
99 99
     {
100
-        $this->registeredCommands[$command->getName()] = $command;
100
+        $this->registeredCommands[ $command->getName() ] = $command;
101 101
     }
102 102
 
103 103
     /**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
     private function register(Command $command)
109 109
     {
110 110
         // add to registered commands if not already registered.
111
-        if(!$this->has($command->getName()))
112
-            $this->registeredCommands[$command->getName()] = $command;
111
+        if (!$this->has($command->getName()))
112
+            $this->registeredCommands[ $command->getName() ] = $command;
113 113
     }
114 114
 
115 115
     /**
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
      */
121 121
     private function load($path)
122 122
     {
123
-        $file = explode(ROOT_PATH."/", explode('.php', $path)[0])[1];
123
+        $file = explode(ROOT_PATH."/", explode('.php', $path)[ 0 ])[ 1 ];
124 124
         $file = "\\".str_replace('/', '\\', $file);
125 125
 
126
-        if(class_exists($file)) {
126
+        if (class_exists($file)) {
127 127
             $tempClass = new $file;
128 128
 
129
-            if($tempClass instanceof Command)
129
+            if ($tempClass instanceof Command)
130 130
                 return new $file;
131 131
         }
132 132
         return false;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
     private function register(Command $command)
109 109
     {
110 110
         // add to registered commands if not already registered.
111
-        if(!$this->has($command->getName()))
112
-            $this->registeredCommands[$command->getName()] = $command;
111
+        if(!$this->has($command->getName())) {
112
+                    $this->registeredCommands[$command->getName()] = $command;
113
+        }
113 114
     }
114 115
 
115 116
     /**
@@ -126,8 +127,9 @@  discard block
 block discarded – undo
126 127
         if(class_exists($file)) {
127 128
             $tempClass = new $file;
128 129
 
129
-            if($tempClass instanceof Command)
130
-                return new $file;
130
+            if($tempClass instanceof Command) {
131
+                            return new $file;
132
+            }
131 133
         }
132 134
         return false;
133 135
     }
Please login to merge, or discard this patch.
app/framework/Component/Console/Terminal.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
     private static $height;
15 15
 
16 16
     private static $descriptorSpec = [
17
-        1 => ['pipe', 'w'],
18
-        2 => ['pipe', 'w'],
17
+        1 => [ 'pipe', 'w' ],
18
+        2 => [ 'pipe', 'w' ],
19 19
     ];
20 20
 
21 21
     public function getWidth()
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         if ($width !== false)
26 26
             return (int) trim($width);
27 27
 
28
-        if(self::$width === null)
28
+        if (self::$width === null)
29 29
             self::initDimensions();
30 30
 
31 31
         return self::$width ?: 80;
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $height = getenv('ROWS');
37 37
 
38
-        if($height !== false)
38
+        if ($height !== false)
39 39
             return (int) $height;
40 40
 
41
-        if(self::$height !== false)
41
+        if (self::$height !== false)
42 42
             self::initDimensions();
43 43
 
44 44
         return self::$height ?: 60;
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
             if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
51 51
                 // extract [w, H] from "wxh (WxH)"
52 52
                 // or [w, h] from "wxh"
53
-                self::$width = (int) $matches[1];
54
-                self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
53
+                self::$width = (int) $matches[ 1 ];
54
+                self::$height = isset($matches[ 4 ]) ? (int) $matches[ 4 ] : (int) $matches[ 2 ];
55 55
             } elseif (null !== $dimensions = self::getConsoleMode()) {
56 56
                 // extract [w, h] from "wxh"
57
-                self::$width = (int) $dimensions[0];
58
-                self::$height = (int) $dimensions[1];
57
+                self::$width = (int) $dimensions[ 0 ];
58
+                self::$height = (int) $dimensions[ 1 ];
59 59
             }
60 60
         } elseif ($sttyString = self::getSttyColumns()) {
61 61
             if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
62 62
                 // extract [w, h] from "rows h; columns w;"
63
-                self::$width = (int) $matches[2];
64
-                self::$height = (int) $matches[1];
63
+                self::$width = (int) $matches[ 2 ];
64
+                self::$height = (int) $matches[ 1 ];
65 65
             } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
66 66
                 // extract [w, h] from "; h rows; w columns"
67
-                self::$width = (int) $matches[2];
68
-                self::$height = (int) $matches[1];
67
+                self::$width = (int) $matches[ 2 ];
68
+                self::$height = (int) $matches[ 1 ];
69 69
             }
70 70
         }
71 71
     }
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
             return;
82 82
         }
83 83
 
84
-        $process = proc_open('mode CON', self::$descriptorSpec, $pipes, null, null, ['suppress_errors' => true]);
84
+        $process = proc_open('mode CON', self::$descriptorSpec, $pipes, null, null, [ 'suppress_errors' => true ]);
85 85
 
86 86
         if (is_resource($process)) {
87
-            $info = stream_get_contents($pipes[1]);
88
-            fclose($pipes[1]);
89
-            fclose($pipes[2]);
87
+            $info = stream_get_contents($pipes[ 1 ]);
88
+            fclose($pipes[ 1 ]);
89
+            fclose($pipes[ 2 ]);
90 90
             proc_close($process);
91 91
             if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
92
-                return array((int) $matches[2], (int) $matches[1]);
92
+                return array((int) $matches[ 2 ], (int) $matches[ 1 ]);
93 93
             }
94 94
         }
95 95
     }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
             return;
106 106
         }
107 107
 
108
-        $process = proc_open('stty -a | grep columns', self::$descriptorSpec, $pipes, null, null, ['suppress_errors' => true]);
108
+        $process = proc_open('stty -a | grep columns', self::$descriptorSpec, $pipes, null, null, [ 'suppress_errors' => true ]);
109 109
 
110 110
         if (is_resource($process)) {
111
-            $info = stream_get_contents($pipes[1]);
112
-            fclose($pipes[1]);
113
-            fclose($pipes[2]);
111
+            $info = stream_get_contents($pipes[ 1 ]);
112
+            fclose($pipes[ 1 ]);
113
+            fclose($pipes[ 2 ]);
114 114
             proc_close($process);
115 115
 
116 116
             return $info;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,11 +22,13 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $width = getenv('COLUMNS');
24 24
 
25
-        if ($width !== false)
26
-            return (int) trim($width);
25
+        if ($width !== false) {
26
+                    return (int) trim($width);
27
+        }
27 28
 
28
-        if(self::$width === null)
29
-            self::initDimensions();
29
+        if(self::$width === null) {
30
+                    self::initDimensions();
31
+        }
30 32
 
31 33
         return self::$width ?: 80;
32 34
     }
@@ -35,11 +37,13 @@  discard block
 block discarded – undo
35 37
     {
36 38
         $height = getenv('ROWS');
37 39
 
38
-        if($height !== false)
39
-            return (int) $height;
40
+        if($height !== false) {
41
+                    return (int) $height;
42
+        }
40 43
 
41
-        if(self::$height !== false)
42
-            self::initDimensions();
44
+        if(self::$height !== false) {
45
+                    self::initDimensions();
46
+        }
43 47
 
44 48
         return self::$height ?: 60;
45 49
     }
Please login to merge, or discard this patch.
app/framework/Component/Console/Input/ArgvInput.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function __construct(array $argv = null, InputDefinition $definition = null)
47 47
     {
48 48
         if (null === $argv) {
49
-            $argv = $_SERVER['argv'];
49
+            $argv = $_SERVER[ 'argv' ];
50 50
         }
51 51
 
52 52
         // strip the application name
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function getFirstArgument()
64 64
     {
65 65
         foreach ($this->tokens as $token) {
66
-            if ($token && '-' === $token[0]) {
66
+            if ($token && '-' === $token[ 0 ]) {
67 67
                 continue;
68 68
             }
69 69
             return $token;
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function __toString()
130 130
     {
131
-        $tokens = array_map(function ($token) {
131
+        $tokens = array_map(function($token) {
132 132
             if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
133
-                return $match[1].$this->escapeToken($match[2]);
133
+                return $match[ 1 ].$this->escapeToken($match[ 2 ]);
134 134
             }
135
-            if ($token && '-' !== $token[0]) {
135
+            if ($token && '-' !== $token[ 0 ]) {
136 136
                 return $this->escapeToken($token);
137 137
             }
138 138
             return $token;
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $name = substr($token, 1);
151 151
         if (strlen($name) > 1) {
152
-            if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
152
+            if ($this->definition->hasShortcut($name[ 0 ]) && $this->definition->getOptionForShortcut($name[ 0 ])->acceptValue()) {
153 153
                 // an option with a value (with no space)
154
-                $this->addShortOption($name[0], substr($name, 1));
154
+                $this->addShortOption($name[ 0 ], substr($name, 1));
155 155
             } else {
156 156
                 $this->parseShortOptionSet($name);
157 157
             }
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $len = strlen($name);
173 173
         for ($i = 0; $i < $len; ++$i) {
174
-            if (!$this->definition->hasShortcut($name[$i]))
175
-                throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
174
+            if (!$this->definition->hasShortcut($name[ $i ]))
175
+                throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[ $i ]));
176 176
 
177
-            $option = $this->definition->getOptionForShortcut($name[$i]);
177
+            $option = $this->definition->getOptionForShortcut($name[ $i ]);
178 178
             if ($option->acceptValue()) {
179 179
                 $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
180 180
                 break;
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
         // if input is expecting another argument, add it
217 217
         if ($this->definition->hasArgument($c)) {
218 218
             $arg = $this->definition->getArgument($c);
219
-            $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
219
+            $this->arguments[ $arg->getName() ] = $arg->isArray() ? array($token) : $token;
220 220
 
221 221
             // if last argument isArray(), append token to last argument
222 222
         } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
223 223
             $arg = $this->definition->getArgument($c - 1);
224
-            $this->arguments[$arg->getName()][] = $token;
224
+            $this->arguments[ $arg->getName() ][ ] = $token;
225 225
 
226 226
             // unexpected argument
227 227
         } else {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             // if option accepts an optional or mandatory argument
273 273
             // let's see if there is one provided
274 274
             $next = array_shift($this->parsed);
275
-            if ((isset($next[0]) && '-' !== $next[0]) || in_array($next, array('', null), true)) {
275
+            if ((isset($next[ 0 ]) && '-' !== $next[ 0 ]) || in_array($next, array('', null), true)) {
276 276
                 $value = $next;
277 277
             } else {
278 278
                 array_unshift($this->parsed, $next);
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
         }
290 290
 
291 291
         if ($option->isArray()) {
292
-            $this->options[$name][] = $value;
292
+            $this->options[ $name ][ ] = $value;
293 293
         } else {
294
-            $this->options[$name] = $value;
294
+            $this->options[ $name ] = $value;
295 295
         }
296 296
     }
297 297
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                 $parseOptions = false;
311 311
             } elseif ($parseOptions && 0 === strpos($token, '--')) {
312 312
                 $this->parseLongOption($token);
313
-            } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
313
+            } elseif ($parseOptions && '-' === $token[ 0 ] && '-' !== $token) {
314 314
                 $this->parseShortOption($token);
315 315
             } else {
316 316
                 $this->parseArgument($token);
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -171,8 +171,9 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $len = strlen($name);
173 173
         for ($i = 0; $i < $len; ++$i) {
174
-            if (!$this->definition->hasShortcut($name[$i]))
175
-                throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
174
+            if (!$this->definition->hasShortcut($name[$i])) {
175
+                            throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
176
+            }
176 177
 
177 178
             $option = $this->definition->getOptionForShortcut($name[$i]);
178 179
             if ($option->acceptValue()) {
@@ -243,8 +244,9 @@  discard block
 block discarded – undo
243 244
      */
244 245
     private function addShortOption($shortcut, $value)
245 246
     {
246
-        if (!$this->definition->hasShortcut($shortcut))
247
-            throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
247
+        if (!$this->definition->hasShortcut($shortcut)) {
248
+                    throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
249
+        }
248 250
 
249 251
         $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
250 252
     }
@@ -259,14 +261,16 @@  discard block
 block discarded – undo
259 261
      */
260 262
     private function addLongOption($name, $value)
261 263
     {
262
-        if (!$this->definition->hasOption($name))
263
-            throw new \RuntimeException(sprintf('The "--%s" option does not exist.', $name));
264
+        if (!$this->definition->hasOption($name)) {
265
+                    throw new \RuntimeException(sprintf('The "--%s" option does not exist.', $name));
266
+        }
264 267
 
265 268
         /**@var $option InputOption*/
266 269
         $option = $this->definition->getOption($name);
267 270
 
268
-        if (null !== $value && !$option->acceptValue())
269
-            throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
271
+        if (null !== $value && !$option->acceptValue()) {
272
+                    throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
273
+        }
270 274
 
271 275
         if (in_array($value, array('', null), true) && $option->acceptValue() && count($this->parsed)) {
272 276
             // if option accepts an optional or mandatory argument
@@ -280,11 +284,13 @@  discard block
 block discarded – undo
280 284
         }
281 285
 
282 286
         if (null === $value) {
283
-            if ($option->isValueRequired())
284
-                throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name));
287
+            if ($option->isValueRequired()) {
288
+                            throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name));
289
+            }
285 290
 
286
-            if (!$option->isArray() && !$option->isValueOptional())
287
-                $value = true;
291
+            if (!$option->isArray() && !$option->isValueOptional()) {
292
+                            $value = true;
293
+            }
288 294
 
289 295
         }
290 296
 
Please login to merge, or discard this patch.
app/framework/Component/Console/Input/InputArgument.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
      * @param $default
32 32
      * @param $description
33 33
      */
34
-    public function __construct(string $name, int $mode = null, string $description= '', $default = null)
34
+    public function __construct(string $name, int $mode = null, string $description = '', $default = null)
35 35
     {
36
-        if($mode === null) {
36
+        if ($mode === null) {
37 37
             $mode = self::OPTIONAL;
38
-        } elseif($mode > 7 || $mode < 1) {
38
+        } elseif ($mode > 7 || $mode < 1) {
39 39
             throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid', $mode));
40 40
         }
41 41
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function setDefault($default = null)
115 115
     {
116
-        if(self::REQUIRED === $this->mode && null !== $default)
116
+        if (self::REQUIRED === $this->mode && null !== $default)
117 117
             throw new \LogicException('Cannot set default value except for InputArgument::OPTIONAL mode.');
118 118
 
119
-        if($this->isArray()) {
120
-            if(null === $default) {
119
+        if ($this->isArray()) {
120
+            if (null === $default) {
121 121
                 $default = array();
122
-            } elseif(!is_array($default)) {
122
+            } elseif (!is_array($default)) {
123 123
                 throw new \LogicException('A default value for an array option must be an array.');
124 124
             }
125 125
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,8 +113,9 @@
 block discarded – undo
113 113
      */
114 114
     public function setDefault($default = null)
115 115
     {
116
-        if(self::REQUIRED === $this->mode && null !== $default)
117
-            throw new \LogicException('Cannot set default value except for InputArgument::OPTIONAL mode.');
116
+        if(self::REQUIRED === $this->mode && null !== $default) {
117
+                    throw new \LogicException('Cannot set default value except for InputArgument::OPTIONAL mode.');
118
+        }
118 119
 
119 120
         if($this->isArray()) {
120 121
             if(null === $default) {
Please login to merge, or discard this patch.
app/framework/Component/Console/Input/InputOption.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
38 38
     {
39
-        if(empty($name))
39
+        if (empty($name))
40 40
             throw new \InvalidArgumentException('An option name cannot be empty.');
41 41
 
42 42
         if (empty($shortcut))
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
         }
58 58
 
59
-        if(null === $mode) {
59
+        if (null === $mode) {
60 60
             $mode = self::VALUE_NONE;
61
-        } elseif($mode > 15 || $mode < 1) {
61
+        } elseif ($mode > 15 || $mode < 1) {
62 62
             throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
63 63
         }
64 64
 
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function setDefault($default = null)
163 163
     {
164
-        if(self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default)
164
+        if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default)
165 165
             throw new \LogicException('Cannot set default value when using InputOption::VALUE_NONE mode.');
166 166
 
167
-        if($this->isArray()) {
168
-            if(null === $default) {
167
+        if ($this->isArray()) {
168
+            if (null === $default) {
169 169
                 $default = array();
170
-            } elseif(!is_array($default)) {
170
+            } elseif (!is_array($default)) {
171 171
                 throw new \LogicException('A default value for an array option must be an array.');
172 172
             }
173 173
         }
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,23 +36,27 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
38 38
     {
39
-        if(empty($name))
40
-            throw new \InvalidArgumentException('An option name cannot be empty.');
39
+        if(empty($name)) {
40
+                    throw new \InvalidArgumentException('An option name cannot be empty.');
41
+        }
41 42
 
42
-        if (empty($shortcut))
43
-            $shortcut = null;
43
+        if (empty($shortcut)) {
44
+                    $shortcut = null;
45
+        }
44 46
 
45 47
 
46 48
         if (null !== $shortcut) {
47
-            if (is_array($shortcut))
48
-                $shortcut = implode('|', $shortcut);
49
+            if (is_array($shortcut)) {
50
+                            $shortcut = implode('|', $shortcut);
51
+            }
49 52
 
50 53
             $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
51 54
             $shortcuts = array_filter($shortcuts);
52 55
             $shortcut = implode('|', $shortcuts);
53 56
 
54
-            if (empty($shortcut))
55
-                throw new \InvalidArgumentException('An option shortcut cannot be empty.');
57
+            if (empty($shortcut)) {
58
+                            throw new \InvalidArgumentException('An option shortcut cannot be empty.');
59
+            }
56 60
 
57 61
         }
58 62
 
@@ -161,8 +165,9 @@  discard block
 block discarded – undo
161 165
      */
162 166
     public function setDefault($default = null)
163 167
     {
164
-        if(self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default)
165
-            throw new \LogicException('Cannot set default value when using InputOption::VALUE_NONE mode.');
168
+        if(self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
169
+                    throw new \LogicException('Cannot set default value when using InputOption::VALUE_NONE mode.');
170
+        }
166 171
 
167 172
         if($this->isArray()) {
168 173
             if(null === $default) {
Please login to merge, or discard this patch.