Completed
Push — develop ( 316159...00443b )
by Zack
20:22
created
vendor/symfony/console/Output/ConsoleSectionOutput.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class ConsoleSectionOutput extends StreamOutput
23 23
 {
24
-    private $content = [];
24
+    private $content = [ ];
25 25
     private $lines = 0;
26 26
     private $sections;
27 27
     private $terminal;
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
      * @param resource               $stream
31 31
      * @param ConsoleSectionOutput[] $sections
32 32
      */
33
-    public function __construct($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
33
+    public function __construct( $stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter )
34 34
     {
35
-        parent::__construct($stream, $verbosity, $decorated, $formatter);
36
-        array_unshift($sections, $this);
35
+        parent::__construct( $stream, $verbosity, $decorated, $formatter );
36
+        array_unshift( $sections, $this );
37 37
         $this->sections = &$sections;
38 38
         $this->terminal = new Terminal();
39 39
     }
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared
45 45
      */
46
-    public function clear(int $lines = null)
46
+    public function clear( int $lines = null )
47 47
     {
48
-        if (empty($this->content) || !$this->isDecorated()) {
48
+        if ( empty( $this->content ) || ! $this->isDecorated() ) {
49 49
             return;
50 50
         }
51 51
 
52
-        if ($lines) {
53
-            array_splice($this->content, -($lines * 2)); // Multiply lines by 2 to cater for each new line added between content
52
+        if ( $lines ) {
53
+            array_splice( $this->content, -( $lines * 2 ) ); // Multiply lines by 2 to cater for each new line added between content
54 54
         } else {
55 55
             $lines = $this->lines;
56
-            $this->content = [];
56
+            $this->content = [ ];
57 57
         }
58 58
 
59 59
         $this->lines -= $lines;
60 60
 
61
-        parent::doWrite($this->popStreamContentUntilCurrentSection($lines), false);
61
+        parent::doWrite( $this->popStreamContentUntilCurrentSection( $lines ), false );
62 62
     }
63 63
 
64 64
     /**
@@ -66,78 +66,78 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @param array|string $message
68 68
      */
69
-    public function overwrite($message)
69
+    public function overwrite( $message )
70 70
     {
71 71
         $this->clear();
72
-        $this->writeln($message);
72
+        $this->writeln( $message );
73 73
     }
74 74
 
75 75
     public function getContent(): string
76 76
     {
77
-        return implode('', $this->content);
77
+        return implode( '', $this->content );
78 78
     }
79 79
 
80 80
     /**
81 81
      * @internal
82 82
      */
83
-    public function addContent(string $input)
83
+    public function addContent( string $input )
84 84
     {
85
-        foreach (explode(\PHP_EOL, $input) as $lineContent) {
86
-            $this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
87
-            $this->content[] = $lineContent;
88
-            $this->content[] = \PHP_EOL;
85
+        foreach ( explode( \PHP_EOL, $input ) as $lineContent ) {
86
+            $this->lines += ceil( $this->getDisplayLength( $lineContent ) / $this->terminal->getWidth() ) ?: 1;
87
+            $this->content[ ] = $lineContent;
88
+            $this->content[ ] = \PHP_EOL;
89 89
         }
90 90
     }
91 91
 
92 92
     /**
93 93
      * {@inheritdoc}
94 94
      */
95
-    protected function doWrite(string $message, bool $newline)
95
+    protected function doWrite( string $message, bool $newline )
96 96
     {
97
-        if (!$this->isDecorated()) {
98
-            parent::doWrite($message, $newline);
97
+        if ( ! $this->isDecorated() ) {
98
+            parent::doWrite( $message, $newline );
99 99
 
100 100
             return;
101 101
         }
102 102
 
103 103
         $erasedContent = $this->popStreamContentUntilCurrentSection();
104 104
 
105
-        $this->addContent($message);
105
+        $this->addContent( $message );
106 106
 
107
-        parent::doWrite($message, true);
108
-        parent::doWrite($erasedContent, false);
107
+        parent::doWrite( $message, true );
108
+        parent::doWrite( $erasedContent, false );
109 109
     }
110 110
 
111 111
     /**
112 112
      * At initial stage, cursor is at the end of stream output. This method makes cursor crawl upwards until it hits
113 113
      * current section. Then it erases content it crawled through. Optionally, it erases part of current section too.
114 114
      */
115
-    private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
115
+    private function popStreamContentUntilCurrentSection( int $numberOfLinesToClearFromCurrentSection = 0 ): string
116 116
     {
117 117
         $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
118
-        $erasedContent = [];
118
+        $erasedContent = [ ];
119 119
 
120
-        foreach ($this->sections as $section) {
121
-            if ($section === $this) {
120
+        foreach ( $this->sections as $section ) {
121
+            if ( $section === $this ) {
122 122
                 break;
123 123
             }
124 124
 
125 125
             $numberOfLinesToClear += $section->lines;
126
-            $erasedContent[] = $section->getContent();
126
+            $erasedContent[ ] = $section->getContent();
127 127
         }
128 128
 
129
-        if ($numberOfLinesToClear > 0) {
129
+        if ( $numberOfLinesToClear > 0 ) {
130 130
             // move cursor up n lines
131
-            parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
131
+            parent::doWrite( sprintf( "\x1b[%dA", $numberOfLinesToClear ), false );
132 132
             // erase to end of screen
133
-            parent::doWrite("\x1b[0J", false);
133
+            parent::doWrite( "\x1b[0J", false );
134 134
         }
135 135
 
136
-        return implode('', array_reverse($erasedContent));
136
+        return implode( '', array_reverse( $erasedContent ) );
137 137
     }
138 138
 
139
-    private function getDisplayLength(string $text): int
139
+    private function getDisplayLength( string $text ): int
140 140
     {
141
-        return Helper::width(Helper::removeDecoration($this->getFormatter(), str_replace("\t", '        ', $text)));
141
+        return Helper::width( Helper::removeDecoration( $this->getFormatter(), str_replace( "\t", '        ', $text ) ) );
142 142
     }
143 143
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Output/NullOutput.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * {@inheritdoc}
31 31
      */
32
-    public function setFormatter(OutputFormatterInterface $formatter)
32
+    public function setFormatter( OutputFormatterInterface $formatter )
33 33
     {
34 34
         // do nothing
35 35
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function getFormatter()
41 41
     {
42
-        if ($this->formatter) {
42
+        if ( $this->formatter ) {
43 43
             return $this->formatter;
44 44
         }
45 45
         // to comply with the interface we must return a OutputFormatterInterface
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * {@inheritdoc}
51 51
      */
52
-    public function setDecorated(bool $decorated)
52
+    public function setDecorated( bool $decorated )
53 53
     {
54 54
         // do nothing
55 55
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     /**
66 66
      * {@inheritdoc}
67 67
      */
68
-    public function setVerbosity(int $level)
68
+    public function setVerbosity( int $level )
69 69
     {
70 70
         // do nothing
71 71
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     /**
114 114
      * {@inheritdoc}
115 115
      */
116
-    public function writeln($messages, int $options = self::OUTPUT_NORMAL)
116
+    public function writeln( $messages, int $options = self::OUTPUT_NORMAL )
117 117
     {
118 118
         // do nothing
119 119
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     /**
122 122
      * {@inheritdoc}
123 123
      */
124
-    public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
124
+    public function write( $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL )
125 125
     {
126 126
         // do nothing
127 127
     }
Please login to merge, or discard this patch.
vendor/symfony/console/Input/InputOption.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -61,37 +61,37 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @throws InvalidArgumentException If option mode is invalid or incompatible
63 63
      */
64
-    public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
64
+    public function __construct( string $name, $shortcut = null, int $mode = null, string $description = '', $default = null )
65 65
     {
66
-        if (str_starts_with($name, '--')) {
67
-            $name = substr($name, 2);
66
+        if ( str_starts_with( $name, '--' ) ) {
67
+            $name = substr( $name, 2 );
68 68
         }
69 69
 
70
-        if (empty($name)) {
71
-            throw new InvalidArgumentException('An option name cannot be empty.');
70
+        if ( empty( $name ) ) {
71
+            throw new InvalidArgumentException( 'An option name cannot be empty.' );
72 72
         }
73 73
 
74
-        if (empty($shortcut)) {
74
+        if ( empty( $shortcut ) ) {
75 75
             $shortcut = null;
76 76
         }
77 77
 
78
-        if (null !== $shortcut) {
79
-            if (\is_array($shortcut)) {
80
-                $shortcut = implode('|', $shortcut);
78
+        if ( null !== $shortcut ) {
79
+            if ( \is_array( $shortcut ) ) {
80
+                $shortcut = implode( '|', $shortcut );
81 81
             }
82
-            $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
83
-            $shortcuts = array_filter($shortcuts);
84
-            $shortcut = implode('|', $shortcuts);
82
+            $shortcuts = preg_split( '{(\|)-?}', ltrim( $shortcut, '-' ) );
83
+            $shortcuts = array_filter( $shortcuts );
84
+            $shortcut = implode( '|', $shortcuts );
85 85
 
86
-            if (empty($shortcut)) {
87
-                throw new InvalidArgumentException('An option shortcut cannot be empty.');
86
+            if ( empty( $shortcut ) ) {
87
+                throw new InvalidArgumentException( 'An option shortcut cannot be empty.' );
88 88
             }
89 89
         }
90 90
 
91
-        if (null === $mode) {
91
+        if ( null === $mode ) {
92 92
             $mode = self::VALUE_NONE;
93
-        } elseif ($mode >= (self::VALUE_NEGATABLE << 1) || $mode < 1) {
94
-            throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
93
+        } elseif ( $mode >= ( self::VALUE_NEGATABLE << 1 ) || $mode < 1 ) {
94
+            throw new InvalidArgumentException( sprintf( 'Option mode "%s" is not valid.', $mode ) );
95 95
         }
96 96
 
97 97
         $this->name = $name;
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
         $this->mode = $mode;
100 100
         $this->description = $description;
101 101
 
102
-        if ($this->isArray() && !$this->acceptValue()) {
103
-            throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
102
+        if ( $this->isArray() && ! $this->acceptValue() ) {
103
+            throw new InvalidArgumentException( 'Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.' );
104 104
         }
105
-        if ($this->isNegatable() && $this->acceptValue()) {
106
-            throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
105
+        if ( $this->isNegatable() && $this->acceptValue() ) {
106
+            throw new InvalidArgumentException( 'Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.' );
107 107
         }
108 108
 
109
-        $this->setDefault($default);
109
+        $this->setDefault( $default );
110 110
     }
111 111
 
112 112
     /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function isValueRequired()
148 148
     {
149
-        return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
149
+        return self::VALUE_REQUIRED === ( self::VALUE_REQUIRED & $this->mode );
150 150
     }
151 151
 
152 152
     /**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function isValueOptional()
158 158
     {
159
-        return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
159
+        return self::VALUE_OPTIONAL === ( self::VALUE_OPTIONAL & $this->mode );
160 160
     }
161 161
 
162 162
     /**
@@ -166,28 +166,28 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function isArray()
168 168
     {
169
-        return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
169
+        return self::VALUE_IS_ARRAY === ( self::VALUE_IS_ARRAY & $this->mode );
170 170
     }
171 171
 
172 172
     public function isNegatable(): bool
173 173
     {
174
-        return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
174
+        return self::VALUE_NEGATABLE === ( self::VALUE_NEGATABLE & $this->mode );
175 175
     }
176 176
 
177 177
     /**
178 178
      * @param string|bool|int|float|array|null $default
179 179
      */
180
-    public function setDefault($default = null)
180
+    public function setDefault( $default = null )
181 181
     {
182
-        if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
183
-            throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
182
+        if ( self::VALUE_NONE === ( self::VALUE_NONE & $this->mode ) && null !== $default ) {
183
+            throw new LogicException( 'Cannot set a default value when using InputOption::VALUE_NONE mode.' );
184 184
         }
185 185
 
186
-        if ($this->isArray()) {
187
-            if (null === $default) {
188
-                $default = [];
189
-            } elseif (!\is_array($default)) {
190
-                throw new LogicException('A default value for an array option must be an array.');
186
+        if ( $this->isArray() ) {
187
+            if ( null === $default ) {
188
+                $default = [ ];
189
+            } elseif ( ! \is_array( $default ) ) {
190
+                throw new LogicException( 'A default value for an array option must be an array.' );
191 191
             }
192 192
         }
193 193
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * @return bool
221 221
      */
222
-    public function equals(self $option)
222
+    public function equals( self $option )
223 223
     {
224 224
         return $option->getName() === $this->getName()
225 225
             && $option->getShortcut() === $this->getShortcut()
Please login to merge, or discard this patch.
vendor/symfony/console/Input/StringInput.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @param string $input A string representing the parameters from the CLI
32 32
      */
33
-    public function __construct(string $input)
33
+    public function __construct( string $input )
34 34
     {
35
-        parent::__construct([]);
35
+        parent::__construct( [ ] );
36 36
 
37
-        $this->setTokens($this->tokenize($input));
37
+        $this->setTokens( $this->tokenize( $input ) );
38 38
     }
39 39
 
40 40
     /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @throws InvalidArgumentException When unable to parse input (should never happen)
44 44
      */
45
-    private function tokenize(string $input): array
45
+    private function tokenize( string $input ): array
46 46
     {
47
-        $tokens = [];
48
-        $length = \strlen($input);
47
+        $tokens = [ ];
48
+        $length = \strlen( $input );
49 49
         $cursor = 0;
50
-        while ($cursor < $length) {
51
-            if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
52
-            } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
53
-                $tokens[] = $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
54
-            } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
55
-                $tokens[] = stripcslashes(substr($match[0], 1, -1));
56
-            } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $cursor)) {
57
-                $tokens[] = stripcslashes($match[1]);
50
+        while ( $cursor < $length ) {
51
+            if ( preg_match( '/\s+/A', $input, $match, 0, $cursor ) ) {
52
+            } elseif ( preg_match( '/([^="\'\s]+?)(=?)(' . self::REGEX_QUOTED_STRING . '+)/A', $input, $match, 0, $cursor ) ) {
53
+                $tokens[ ] = $match[ 1 ] . $match[ 2 ] . stripcslashes( str_replace( [ '"\'', '\'"', '\'\'', '""' ], '', substr( $match[ 3 ], 1, -1 ) ) );
54
+            } elseif ( preg_match( '/' . self::REGEX_QUOTED_STRING . '/A', $input, $match, 0, $cursor ) ) {
55
+                $tokens[ ] = stripcslashes( substr( $match[ 0 ], 1, -1 ) );
56
+            } elseif ( preg_match( '/' . self::REGEX_STRING . '/A', $input, $match, 0, $cursor ) ) {
57
+                $tokens[ ] = stripcslashes( $match[ 1 ] );
58 58
             } else {
59 59
                 // should never happen
60
-                throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
60
+                throw new InvalidArgumentException( sprintf( 'Unable to parse input near "... %s ...".', substr( $input, $cursor, 10 ) ) );
61 61
             }
62 62
 
63
-            $cursor += \strlen($match[0]);
63
+            $cursor += \strlen( $match[ 0 ] );
64 64
         }
65 65
 
66 66
         return $tokens;
Please login to merge, or discard this patch.
vendor/symfony/console/Input/InputArgument.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @throws InvalidArgumentException When argument mode is not valid
40 40
      */
41
-    public function __construct(string $name, int $mode = null, string $description = '', $default = null)
41
+    public function __construct( string $name, int $mode = null, string $description = '', $default = null )
42 42
     {
43
-        if (null === $mode) {
43
+        if ( null === $mode ) {
44 44
             $mode = self::OPTIONAL;
45
-        } elseif ($mode > 7 || $mode < 1) {
46
-            throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
45
+        } elseif ( $mode > 7 || $mode < 1 ) {
46
+            throw new InvalidArgumentException( sprintf( 'Argument mode "%s" is not valid.', $mode ) );
47 47
         }
48 48
 
49 49
         $this->name = $name;
50 50
         $this->mode = $mode;
51 51
         $this->description = $description;
52 52
 
53
-        $this->setDefault($default);
53
+        $this->setDefault( $default );
54 54
     }
55 55
 
56 56
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function isRequired()
72 72
     {
73
-        return self::REQUIRED === (self::REQUIRED & $this->mode);
73
+        return self::REQUIRED === ( self::REQUIRED & $this->mode );
74 74
     }
75 75
 
76 76
     /**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function isArray()
82 82
     {
83
-        return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
83
+        return self::IS_ARRAY === ( self::IS_ARRAY & $this->mode );
84 84
     }
85 85
 
86 86
     /**
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @throws LogicException When incorrect default value is given
92 92
      */
93
-    public function setDefault($default = null)
93
+    public function setDefault( $default = null )
94 94
     {
95
-        if (self::REQUIRED === $this->mode && null !== $default) {
96
-            throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
95
+        if ( self::REQUIRED === $this->mode && null !== $default ) {
96
+            throw new LogicException( 'Cannot set a default value except for InputArgument::OPTIONAL mode.' );
97 97
         }
98 98
 
99
-        if ($this->isArray()) {
100
-            if (null === $default) {
101
-                $default = [];
102
-            } elseif (!\is_array($default)) {
103
-                throw new LogicException('A default value for an array argument must be an array.');
99
+        if ( $this->isArray() ) {
100
+            if ( null === $default ) {
101
+                $default = [ ];
102
+            } elseif ( ! \is_array( $default ) ) {
103
+                throw new LogicException( 'A default value for an array argument must be an array.' );
104 104
             }
105 105
         }
106 106
 
Please login to merge, or discard this patch.
vendor/symfony/console/Input/ArgvInput.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
     private $tokens;
44 44
     private $parsed;
45 45
 
46
-    public function __construct(array $argv = null, InputDefinition $definition = null)
46
+    public function __construct( array $argv = null, InputDefinition $definition = null )
47 47
     {
48
-        $argv = $argv ?? $_SERVER['argv'] ?? [];
48
+        $argv = $argv ?? $_SERVER[ 'argv' ] ?? [ ];
49 49
 
50 50
         // strip the application name
51
-        array_shift($argv);
51
+        array_shift( $argv );
52 52
 
53 53
         $this->tokens = $argv;
54 54
 
55
-        parent::__construct($definition);
55
+        parent::__construct( $definition );
56 56
     }
57 57
 
58
-    protected function setTokens(array $tokens)
58
+    protected function setTokens( array $tokens )
59 59
     {
60 60
         $this->tokens = $tokens;
61 61
     }
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $parseOptions = true;
69 69
         $this->parsed = $this->tokens;
70
-        while (null !== $token = array_shift($this->parsed)) {
71
-            if ($parseOptions && '' == $token) {
72
-                $this->parseArgument($token);
73
-            } elseif ($parseOptions && '--' == $token) {
70
+        while ( null !== $token = array_shift( $this->parsed ) ) {
71
+            if ( $parseOptions && '' == $token ) {
72
+                $this->parseArgument( $token );
73
+            } elseif ( $parseOptions && '--' == $token ) {
74 74
                 $parseOptions = false;
75
-            } elseif ($parseOptions && str_starts_with($token, '--')) {
76
-                $this->parseLongOption($token);
77
-            } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
78
-                $this->parseShortOption($token);
75
+            } elseif ( $parseOptions && str_starts_with( $token, '--' ) ) {
76
+                $this->parseLongOption( $token );
77
+            } elseif ( $parseOptions && '-' === $token[ 0 ] && '-' !== $token ) {
78
+                $this->parseShortOption( $token );
79 79
             } else {
80
-                $this->parseArgument($token);
80
+                $this->parseArgument( $token );
81 81
             }
82 82
         }
83 83
     }
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Parses a short option.
87 87
      */
88
-    private function parseShortOption(string $token)
88
+    private function parseShortOption( string $token )
89 89
     {
90
-        $name = substr($token, 1);
90
+        $name = substr( $token, 1 );
91 91
 
92
-        if (\strlen($name) > 1) {
93
-            if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
92
+        if ( \strlen( $name ) > 1 ) {
93
+            if ( $this->definition->hasShortcut( $name[ 0 ] ) && $this->definition->getOptionForShortcut( $name[ 0 ] )->acceptValue() ) {
94 94
                 // an option with a value (with no space)
95
-                $this->addShortOption($name[0], substr($name, 1));
95
+                $this->addShortOption( $name[ 0 ], substr( $name, 1 ) );
96 96
             } else {
97
-                $this->parseShortOptionSet($name);
97
+                $this->parseShortOptionSet( $name );
98 98
             }
99 99
         } else {
100
-            $this->addShortOption($name, null);
100
+            $this->addShortOption( $name, null );
101 101
         }
102 102
     }
103 103
 
@@ -106,22 +106,22 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @throws RuntimeException When option given doesn't exist
108 108
      */
109
-    private function parseShortOptionSet(string $name)
109
+    private function parseShortOptionSet( string $name )
110 110
     {
111
-        $len = \strlen($name);
112
-        for ($i = 0; $i < $len; ++$i) {
113
-            if (!$this->definition->hasShortcut($name[$i])) {
114
-                $encoding = mb_detect_encoding($name, null, true);
115
-                throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
111
+        $len = \strlen( $name );
112
+        for ( $i = 0; $i < $len; ++$i ) {
113
+            if ( ! $this->definition->hasShortcut( $name[ $i ] ) ) {
114
+                $encoding = mb_detect_encoding( $name, null, true );
115
+                throw new RuntimeException( sprintf( 'The "-%s" option does not exist.', false === $encoding ? $name[ $i ] : mb_substr( $name, $i, 1, $encoding ) ) );
116 116
             }
117 117
 
118
-            $option = $this->definition->getOptionForShortcut($name[$i]);
119
-            if ($option->acceptValue()) {
120
-                $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
118
+            $option = $this->definition->getOptionForShortcut( $name[ $i ] );
119
+            if ( $option->acceptValue() ) {
120
+                $this->addLongOption( $option->getName(), $i === $len - 1 ? null : substr( $name, $i + 1 ) );
121 121
 
122 122
                 break;
123 123
             } else {
124
-                $this->addLongOption($option->getName(), null);
124
+                $this->addLongOption( $option->getName(), null );
125 125
             }
126 126
         }
127 127
     }
@@ -129,17 +129,17 @@  discard block
 block discarded – undo
129 129
     /**
130 130
      * Parses a long option.
131 131
      */
132
-    private function parseLongOption(string $token)
132
+    private function parseLongOption( string $token )
133 133
     {
134
-        $name = substr($token, 2);
134
+        $name = substr( $token, 2 );
135 135
 
136
-        if (false !== $pos = strpos($name, '=')) {
137
-            if (0 === \strlen($value = substr($name, $pos + 1))) {
138
-                array_unshift($this->parsed, $value);
136
+        if ( false !== $pos = strpos( $name, '=' ) ) {
137
+            if ( 0 === \strlen( $value = substr( $name, $pos + 1 ) ) ) {
138
+                array_unshift( $this->parsed, $value );
139 139
             }
140
-            $this->addLongOption(substr($name, 0, $pos), $value);
140
+            $this->addLongOption( substr( $name, 0, $pos ), $value );
141 141
         } else {
142
-            $this->addLongOption($name, null);
142
+            $this->addLongOption( $name, null );
143 143
         }
144 144
     }
145 145
 
@@ -148,42 +148,42 @@  discard block
 block discarded – undo
148 148
      *
149 149
      * @throws RuntimeException When too many arguments are given
150 150
      */
151
-    private function parseArgument(string $token)
151
+    private function parseArgument( string $token )
152 152
     {
153
-        $c = \count($this->arguments);
153
+        $c = \count( $this->arguments );
154 154
 
155 155
         // if input is expecting another argument, add it
156
-        if ($this->definition->hasArgument($c)) {
157
-            $arg = $this->definition->getArgument($c);
158
-            $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
156
+        if ( $this->definition->hasArgument( $c ) ) {
157
+            $arg = $this->definition->getArgument( $c );
158
+            $this->arguments[ $arg->getName() ] = $arg->isArray() ? [ $token ] : $token;
159 159
 
160 160
         // if last argument isArray(), append token to last argument
161
-        } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
162
-            $arg = $this->definition->getArgument($c - 1);
163
-            $this->arguments[$arg->getName()][] = $token;
161
+        } elseif ( $this->definition->hasArgument( $c - 1 ) && $this->definition->getArgument( $c - 1 )->isArray() ) {
162
+            $arg = $this->definition->getArgument( $c - 1 );
163
+            $this->arguments[ $arg->getName() ][ ] = $token;
164 164
 
165 165
         // unexpected argument
166 166
         } else {
167 167
             $all = $this->definition->getArguments();
168 168
             $symfonyCommandName = null;
169
-            if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) {
170
-                $symfonyCommandName = $this->arguments['command'] ?? null;
171
-                unset($all[$key]);
169
+            if ( ( $inputArgument = $all[ $key = array_key_first( $all ) ] ?? null ) && 'command' === $inputArgument->getName() ) {
170
+                $symfonyCommandName = $this->arguments[ 'command' ] ?? null;
171
+                unset( $all[ $key ] );
172 172
             }
173 173
 
174
-            if (\count($all)) {
175
-                if ($symfonyCommandName) {
176
-                    $message = sprintf('Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode('" "', array_keys($all)));
174
+            if ( \count( $all ) ) {
175
+                if ( $symfonyCommandName ) {
176
+                    $message = sprintf( 'Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode( '" "', array_keys( $all ) ) );
177 177
                 } else {
178
-                    $message = sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)));
178
+                    $message = sprintf( 'Too many arguments, expected arguments "%s".', implode( '" "', array_keys( $all ) ) );
179 179
                 }
180
-            } elseif ($symfonyCommandName) {
181
-                $message = sprintf('No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token);
180
+            } elseif ( $symfonyCommandName ) {
181
+                $message = sprintf( 'No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token );
182 182
             } else {
183
-                $message = sprintf('No arguments expected, got "%s".', $token);
183
+                $message = sprintf( 'No arguments expected, got "%s".', $token );
184 184
             }
185 185
 
186
-            throw new RuntimeException($message);
186
+            throw new RuntimeException( $message );
187 187
         }
188 188
     }
189 189
 
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
      *
193 193
      * @throws RuntimeException When option given doesn't exist
194 194
      */
195
-    private function addShortOption(string $shortcut, $value)
195
+    private function addShortOption( string $shortcut, $value )
196 196
     {
197
-        if (!$this->definition->hasShortcut($shortcut)) {
198
-            throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
197
+        if ( ! $this->definition->hasShortcut( $shortcut ) ) {
198
+            throw new RuntimeException( sprintf( 'The "-%s" option does not exist.', $shortcut ) );
199 199
         }
200 200
 
201
-        $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
201
+        $this->addLongOption( $this->definition->getOptionForShortcut( $shortcut )->getName(), $value );
202 202
     }
203 203
 
204 204
     /**
@@ -206,53 +206,53 @@  discard block
 block discarded – undo
206 206
      *
207 207
      * @throws RuntimeException When option given doesn't exist
208 208
      */
209
-    private function addLongOption(string $name, $value)
209
+    private function addLongOption( string $name, $value )
210 210
     {
211
-        if (!$this->definition->hasOption($name)) {
212
-            if (!$this->definition->hasNegation($name)) {
213
-                throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
211
+        if ( ! $this->definition->hasOption( $name ) ) {
212
+            if ( ! $this->definition->hasNegation( $name ) ) {
213
+                throw new RuntimeException( sprintf( 'The "--%s" option does not exist.', $name ) );
214 214
             }
215 215
 
216
-            $optionName = $this->definition->negationToName($name);
217
-            if (null !== $value) {
218
-                throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
216
+            $optionName = $this->definition->negationToName( $name );
217
+            if ( null !== $value ) {
218
+                throw new RuntimeException( sprintf( 'The "--%s" option does not accept a value.', $name ) );
219 219
             }
220
-            $this->options[$optionName] = false;
220
+            $this->options[ $optionName ] = false;
221 221
 
222 222
             return;
223 223
         }
224 224
 
225
-        $option = $this->definition->getOption($name);
225
+        $option = $this->definition->getOption( $name );
226 226
 
227
-        if (null !== $value && !$option->acceptValue()) {
228
-            throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
227
+        if ( null !== $value && ! $option->acceptValue() ) {
228
+            throw new RuntimeException( sprintf( 'The "--%s" option does not accept a value.', $name ) );
229 229
         }
230 230
 
231
-        if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {
231
+        if ( \in_array( $value, [ '', null ], true ) && $option->acceptValue() && \count( $this->parsed ) ) {
232 232
             // if option accepts an optional or mandatory argument
233 233
             // let's see if there is one provided
234
-            $next = array_shift($this->parsed);
235
-            if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) {
234
+            $next = array_shift( $this->parsed );
235
+            if ( ( isset( $next[ 0 ] ) && '-' !== $next[ 0 ] ) || \in_array( $next, [ '', null ], true ) ) {
236 236
                 $value = $next;
237 237
             } else {
238
-                array_unshift($this->parsed, $next);
238
+                array_unshift( $this->parsed, $next );
239 239
             }
240 240
         }
241 241
 
242
-        if (null === $value) {
243
-            if ($option->isValueRequired()) {
244
-                throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
242
+        if ( null === $value ) {
243
+            if ( $option->isValueRequired() ) {
244
+                throw new RuntimeException( sprintf( 'The "--%s" option requires a value.', $name ) );
245 245
             }
246 246
 
247
-            if (!$option->isArray() && !$option->isValueOptional()) {
247
+            if ( ! $option->isArray() && ! $option->isValueOptional() ) {
248 248
                 $value = true;
249 249
             }
250 250
         }
251 251
 
252
-        if ($option->isArray()) {
253
-            $this->options[$name][] = $value;
252
+        if ( $option->isArray() ) {
253
+            $this->options[ $name ][ ] = $value;
254 254
         } else {
255
-            $this->options[$name] = $value;
255
+            $this->options[ $name ] = $value;
256 256
         }
257 257
     }
258 258
 
@@ -262,25 +262,25 @@  discard block
 block discarded – undo
262 262
     public function getFirstArgument()
263 263
     {
264 264
         $isOption = false;
265
-        foreach ($this->tokens as $i => $token) {
266
-            if ($token && '-' === $token[0]) {
267
-                if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
265
+        foreach ( $this->tokens as $i => $token ) {
266
+            if ( $token && '-' === $token[ 0 ] ) {
267
+                if ( str_contains( $token, '=' ) || ! isset( $this->tokens[ $i + 1 ] ) ) {
268 268
                     continue;
269 269
                 }
270 270
 
271 271
                 // If it's a long option, consider that everything after "--" is the option name.
272 272
                 // Otherwise, use the last char (if it's a short option set, only the last one can take a value with space separator)
273
-                $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
274
-                if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {
273
+                $name = '-' === $token[ 1 ] ? substr( $token, 2 ) : substr( $token, -1 );
274
+                if ( ! isset( $this->options[ $name ] ) && ! $this->definition->hasShortcut( $name ) ) {
275 275
                     // noop
276
-                } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
276
+                } elseif ( ( isset( $this->options[ $name ] ) || isset( $this->options[ $name = $this->definition->shortcutToName( $name ) ] ) ) && $this->tokens[ $i + 1 ] === $this->options[ $name ] ) {
277 277
                     $isOption = true;
278 278
                 }
279 279
 
280 280
                 continue;
281 281
             }
282 282
 
283
-            if ($isOption) {
283
+            if ( $isOption ) {
284 284
                 $isOption = false;
285 285
                 continue;
286 286
             }
@@ -294,20 +294,20 @@  discard block
 block discarded – undo
294 294
     /**
295 295
      * {@inheritdoc}
296 296
      */
297
-    public function hasParameterOption($values, bool $onlyParams = false)
297
+    public function hasParameterOption( $values, bool $onlyParams = false )
298 298
     {
299
-        $values = (array) $values;
299
+        $values = (array)$values;
300 300
 
301
-        foreach ($this->tokens as $token) {
302
-            if ($onlyParams && '--' === $token) {
301
+        foreach ( $this->tokens as $token ) {
302
+            if ( $onlyParams && '--' === $token ) {
303 303
                 return false;
304 304
             }
305
-            foreach ($values as $value) {
305
+            foreach ( $values as $value ) {
306 306
                 // Options with values:
307 307
                 //   For long options, test for '--option=' at beginning
308 308
                 //   For short options, test for '-o' at beginning
309
-                $leading = str_starts_with($value, '--') ? $value.'=' : $value;
310
-                if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
309
+                $leading = str_starts_with( $value, '--' ) ? $value . '=' : $value;
310
+                if ( $token === $value || '' !== $leading && str_starts_with( $token, $leading ) ) {
311 311
                     return true;
312 312
                 }
313 313
             }
@@ -319,27 +319,27 @@  discard block
 block discarded – undo
319 319
     /**
320 320
      * {@inheritdoc}
321 321
      */
322
-    public function getParameterOption($values, $default = false, bool $onlyParams = false)
322
+    public function getParameterOption( $values, $default = false, bool $onlyParams = false )
323 323
     {
324
-        $values = (array) $values;
324
+        $values = (array)$values;
325 325
         $tokens = $this->tokens;
326 326
 
327
-        while (0 < \count($tokens)) {
328
-            $token = array_shift($tokens);
329
-            if ($onlyParams && '--' === $token) {
327
+        while ( 0 < \count( $tokens ) ) {
328
+            $token = array_shift( $tokens );
329
+            if ( $onlyParams && '--' === $token ) {
330 330
                 return $default;
331 331
             }
332 332
 
333
-            foreach ($values as $value) {
334
-                if ($token === $value) {
335
-                    return array_shift($tokens);
333
+            foreach ( $values as $value ) {
334
+                if ( $token === $value ) {
335
+                    return array_shift( $tokens );
336 336
                 }
337 337
                 // Options with values:
338 338
                 //   For long options, test for '--option=' at beginning
339 339
                 //   For short options, test for '-o' at beginning
340
-                $leading = str_starts_with($value, '--') ? $value.'=' : $value;
341
-                if ('' !== $leading && str_starts_with($token, $leading)) {
342
-                    return substr($token, \strlen($leading));
340
+                $leading = str_starts_with( $value, '--' ) ? $value . '=' : $value;
341
+                if ( '' !== $leading && str_starts_with( $token, $leading ) ) {
342
+                    return substr( $token, \strlen( $leading ) );
343 343
                 }
344 344
             }
345 345
         }
@@ -354,18 +354,18 @@  discard block
 block discarded – undo
354 354
      */
355 355
     public function __toString()
356 356
     {
357
-        $tokens = array_map(function ($token) {
358
-            if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
359
-                return $match[1].$this->escapeToken($match[2]);
357
+        $tokens = array_map( function( $token ) {
358
+            if ( preg_match( '{^(-[^=]+=)(.+)}', $token, $match ) ) {
359
+                return $match[ 1 ] . $this->escapeToken( $match[ 2 ] );
360 360
             }
361 361
 
362
-            if ($token && '-' !== $token[0]) {
363
-                return $this->escapeToken($token);
362
+            if ( $token && '-' !== $token[ 0 ] ) {
363
+                return $this->escapeToken( $token );
364 364
             }
365 365
 
366 366
             return $token;
367
-        }, $this->tokens);
367
+        }, $this->tokens );
368 368
 
369
-        return implode(' ', $tokens);
369
+        return implode( ' ', $tokens );
370 370
     }
371 371
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Input/StreamableInputInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      *
27 27
      * @param resource $stream The input stream
28 28
      */
29
-    public function setStream($stream);
29
+    public function setStream( $stream );
30 30
 
31 31
     /**
32 32
      * Returns the input stream.
Please login to merge, or discard this patch.
vendor/symfony/console/Input/InputInterface.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @return bool true if the value is contained in the raw parameters
43 43
      */
44
-    public function hasParameterOption($values, bool $onlyParams = false);
44
+    public function hasParameterOption( $values, bool $onlyParams = false );
45 45
 
46 46
     /**
47 47
      * Returns the value of a raw option (not parsed).
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return mixed The option value
59 59
      */
60
-    public function getParameterOption($values, $default = false, bool $onlyParams = false);
60
+    public function getParameterOption( $values, $default = false, bool $onlyParams = false );
61 61
 
62 62
     /**
63 63
      * Binds the current Input instance with the given arguments and options.
64 64
      *
65 65
      * @throws RuntimeException
66 66
      */
67
-    public function bind(InputDefinition $definition);
67
+    public function bind( InputDefinition $definition );
68 68
 
69 69
     /**
70 70
      * Validates the input.
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      *
88 88
      * @throws InvalidArgumentException When argument given doesn't exist
89 89
      */
90
-    public function getArgument(string $name);
90
+    public function getArgument( string $name );
91 91
 
92 92
     /**
93 93
      * Sets an argument value by name.
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @throws InvalidArgumentException When argument given doesn't exist
98 98
      */
99
-    public function setArgument(string $name, $value);
99
+    public function setArgument( string $name, $value );
100 100
 
101 101
     /**
102 102
      * Returns true if an InputArgument object exists by name or position.
103 103
      *
104 104
      * @return bool true if the InputArgument object exists, false otherwise
105 105
      */
106
-    public function hasArgument(string $name);
106
+    public function hasArgument( string $name );
107 107
 
108 108
     /**
109 109
      * Returns all the given options merged with the default values.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @throws InvalidArgumentException When option given doesn't exist
121 121
      */
122
-    public function getOption(string $name);
122
+    public function getOption( string $name );
123 123
 
124 124
     /**
125 125
      * Sets an option value by name.
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
      *
129 129
      * @throws InvalidArgumentException When option given doesn't exist
130 130
      */
131
-    public function setOption(string $name, $value);
131
+    public function setOption( string $name, $value );
132 132
 
133 133
     /**
134 134
      * Returns true if an InputOption object exists by name.
135 135
      *
136 136
      * @return bool true if the InputOption object exists, false otherwise
137 137
      */
138
-    public function hasOption(string $name);
138
+    public function hasOption( string $name );
139 139
 
140 140
     /**
141 141
      * Is this input means interactive?
@@ -147,5 +147,5 @@  discard block
 block discarded – undo
147 147
     /**
148 148
      * Sets the input interactivity.
149 149
      */
150
-    public function setInteractive(bool $interactive);
150
+    public function setInteractive( bool $interactive );
151 151
 }
Please login to merge, or discard this patch.
vendor/symfony/console/Input/InputDefinition.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -39,28 +39,28 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * @param array $definition An array of InputArgument and InputOption instance
41 41
      */
42
-    public function __construct(array $definition = [])
42
+    public function __construct( array $definition = [ ] )
43 43
     {
44
-        $this->setDefinition($definition);
44
+        $this->setDefinition( $definition );
45 45
     }
46 46
 
47 47
     /**
48 48
      * Sets the definition of the input.
49 49
      */
50
-    public function setDefinition(array $definition)
50
+    public function setDefinition( array $definition )
51 51
     {
52
-        $arguments = [];
53
-        $options = [];
54
-        foreach ($definition as $item) {
55
-            if ($item instanceof InputOption) {
56
-                $options[] = $item;
52
+        $arguments = [ ];
53
+        $options = [ ];
54
+        foreach ( $definition as $item ) {
55
+            if ( $item instanceof InputOption ) {
56
+                $options[ ] = $item;
57 57
             } else {
58
-                $arguments[] = $item;
58
+                $arguments[ ] = $item;
59 59
             }
60 60
         }
61 61
 
62
-        $this->setArguments($arguments);
63
-        $this->setOptions($options);
62
+        $this->setArguments( $arguments );
63
+        $this->setOptions( $options );
64 64
     }
65 65
 
66 66
     /**
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @param InputArgument[] $arguments An array of InputArgument objects
70 70
      */
71
-    public function setArguments(array $arguments = [])
71
+    public function setArguments( array $arguments = [ ] )
72 72
     {
73
-        $this->arguments = [];
73
+        $this->arguments = [ ];
74 74
         $this->requiredCount = 0;
75 75
         $this->lastOptionalArgument = null;
76 76
         $this->lastArrayArgument = null;
77
-        $this->addArguments($arguments);
77
+        $this->addArguments( $arguments );
78 78
     }
79 79
 
80 80
     /**
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @param InputArgument[] $arguments An array of InputArgument objects
84 84
      */
85
-    public function addArguments(?array $arguments = [])
85
+    public function addArguments( ?array $arguments = [ ] )
86 86
     {
87
-        if (null !== $arguments) {
88
-            foreach ($arguments as $argument) {
89
-                $this->addArgument($argument);
87
+        if ( null !== $arguments ) {
88
+            foreach ( $arguments as $argument ) {
89
+                $this->addArgument( $argument );
90 90
             }
91 91
         }
92 92
     }
@@ -94,31 +94,31 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * @throws LogicException When incorrect argument is given
96 96
      */
97
-    public function addArgument(InputArgument $argument)
97
+    public function addArgument( InputArgument $argument )
98 98
     {
99
-        if (isset($this->arguments[$argument->getName()])) {
100
-            throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
99
+        if ( isset( $this->arguments[ $argument->getName() ] ) ) {
100
+            throw new LogicException( sprintf( 'An argument with name "%s" already exists.', $argument->getName() ) );
101 101
         }
102 102
 
103
-        if (null !== $this->lastArrayArgument) {
104
-            throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
103
+        if ( null !== $this->lastArrayArgument ) {
104
+            throw new LogicException( sprintf( 'Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName() ) );
105 105
         }
106 106
 
107
-        if ($argument->isRequired() && null !== $this->lastOptionalArgument) {
108
-            throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
107
+        if ( $argument->isRequired() && null !== $this->lastOptionalArgument ) {
108
+            throw new LogicException( sprintf( 'Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName() ) );
109 109
         }
110 110
 
111
-        if ($argument->isArray()) {
111
+        if ( $argument->isArray() ) {
112 112
             $this->lastArrayArgument = $argument;
113 113
         }
114 114
 
115
-        if ($argument->isRequired()) {
115
+        if ( $argument->isRequired() ) {
116 116
             ++$this->requiredCount;
117 117
         } else {
118 118
             $this->lastOptionalArgument = $argument;
119 119
         }
120 120
 
121
-        $this->arguments[$argument->getName()] = $argument;
121
+        $this->arguments[ $argument->getName() ] = $argument;
122 122
     }
123 123
 
124 124
     /**
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @throws InvalidArgumentException When argument given doesn't exist
132 132
      */
133
-    public function getArgument($name)
133
+    public function getArgument( $name )
134 134
     {
135
-        if (!$this->hasArgument($name)) {
136
-            throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
135
+        if ( ! $this->hasArgument( $name ) ) {
136
+            throw new InvalidArgumentException( sprintf( 'The "%s" argument does not exist.', $name ) );
137 137
         }
138 138
 
139
-        $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
139
+        $arguments = \is_int( $name ) ? array_values( $this->arguments ) : $this->arguments;
140 140
 
141
-        return $arguments[$name];
141
+        return $arguments[ $name ];
142 142
     }
143 143
 
144 144
     /**
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
      *
149 149
      * @return bool true if the InputArgument object exists, false otherwise
150 150
      */
151
-    public function hasArgument($name)
151
+    public function hasArgument( $name )
152 152
     {
153
-        $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
153
+        $arguments = \is_int( $name ) ? array_values( $this->arguments ) : $this->arguments;
154 154
 
155
-        return isset($arguments[$name]);
155
+        return isset( $arguments[ $name ] );
156 156
     }
157 157
 
158 158
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function getArgumentCount()
174 174
     {
175
-        return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
175
+        return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count( $this->arguments );
176 176
     }
177 177
 
178 178
     /**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function getArgumentDefaults()
192 192
     {
193
-        $values = [];
194
-        foreach ($this->arguments as $argument) {
195
-            $values[$argument->getName()] = $argument->getDefault();
193
+        $values = [ ];
194
+        foreach ( $this->arguments as $argument ) {
195
+            $values[ $argument->getName() ] = $argument->getDefault();
196 196
         }
197 197
 
198 198
         return $values;
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
      *
204 204
      * @param InputOption[] $options An array of InputOption objects
205 205
      */
206
-    public function setOptions(array $options = [])
206
+    public function setOptions( array $options = [ ] )
207 207
     {
208
-        $this->options = [];
209
-        $this->shortcuts = [];
210
-        $this->negations = [];
211
-        $this->addOptions($options);
208
+        $this->options = [ ];
209
+        $this->shortcuts = [ ];
210
+        $this->negations = [ ];
211
+        $this->addOptions( $options );
212 212
     }
213 213
 
214 214
     /**
@@ -216,46 +216,46 @@  discard block
 block discarded – undo
216 216
      *
217 217
      * @param InputOption[] $options An array of InputOption objects
218 218
      */
219
-    public function addOptions(array $options = [])
219
+    public function addOptions( array $options = [ ] )
220 220
     {
221
-        foreach ($options as $option) {
222
-            $this->addOption($option);
221
+        foreach ( $options as $option ) {
222
+            $this->addOption( $option );
223 223
         }
224 224
     }
225 225
 
226 226
     /**
227 227
      * @throws LogicException When option given already exist
228 228
      */
229
-    public function addOption(InputOption $option)
229
+    public function addOption( InputOption $option )
230 230
     {
231
-        if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
232
-            throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
231
+        if ( isset( $this->options[ $option->getName() ] ) && ! $option->equals( $this->options[ $option->getName() ] ) ) {
232
+            throw new LogicException( sprintf( 'An option named "%s" already exists.', $option->getName() ) );
233 233
         }
234
-        if (isset($this->negations[$option->getName()])) {
235
-            throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
234
+        if ( isset( $this->negations[ $option->getName() ] ) ) {
235
+            throw new LogicException( sprintf( 'An option named "%s" already exists.', $option->getName() ) );
236 236
         }
237 237
 
238
-        if ($option->getShortcut()) {
239
-            foreach (explode('|', $option->getShortcut()) as $shortcut) {
240
-                if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
241
-                    throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
238
+        if ( $option->getShortcut() ) {
239
+            foreach ( explode( '|', $option->getShortcut() ) as $shortcut ) {
240
+                if ( isset( $this->shortcuts[ $shortcut ] ) && ! $option->equals( $this->options[ $this->shortcuts[ $shortcut ] ] ) ) {
241
+                    throw new LogicException( sprintf( 'An option with shortcut "%s" already exists.', $shortcut ) );
242 242
                 }
243 243
             }
244 244
         }
245 245
 
246
-        $this->options[$option->getName()] = $option;
247
-        if ($option->getShortcut()) {
248
-            foreach (explode('|', $option->getShortcut()) as $shortcut) {
249
-                $this->shortcuts[$shortcut] = $option->getName();
246
+        $this->options[ $option->getName() ] = $option;
247
+        if ( $option->getShortcut() ) {
248
+            foreach ( explode( '|', $option->getShortcut() ) as $shortcut ) {
249
+                $this->shortcuts[ $shortcut ] = $option->getName();
250 250
             }
251 251
         }
252 252
 
253
-        if ($option->isNegatable()) {
254
-            $negatedName = 'no-'.$option->getName();
255
-            if (isset($this->options[$negatedName])) {
256
-                throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
253
+        if ( $option->isNegatable() ) {
254
+            $negatedName = 'no-' . $option->getName();
255
+            if ( isset( $this->options[ $negatedName ] ) ) {
256
+                throw new LogicException( sprintf( 'An option named "%s" already exists.', $negatedName ) );
257 257
             }
258
-            $this->negations[$negatedName] = $option->getName();
258
+            $this->negations[ $negatedName ] = $option->getName();
259 259
         }
260 260
     }
261 261
 
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
      *
267 267
      * @throws InvalidArgumentException When option given doesn't exist
268 268
      */
269
-    public function getOption(string $name)
269
+    public function getOption( string $name )
270 270
     {
271
-        if (!$this->hasOption($name)) {
272
-            throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
271
+        if ( ! $this->hasOption( $name ) ) {
272
+            throw new InvalidArgumentException( sprintf( 'The "--%s" option does not exist.', $name ) );
273 273
         }
274 274
 
275
-        return $this->options[$name];
275
+        return $this->options[ $name ];
276 276
     }
277 277
 
278 278
     /**
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
      *
284 284
      * @return bool true if the InputOption object exists, false otherwise
285 285
      */
286
-    public function hasOption(string $name)
286
+    public function hasOption( string $name )
287 287
     {
288
-        return isset($this->options[$name]);
288
+        return isset( $this->options[ $name ] );
289 289
     }
290 290
 
291 291
     /**
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
      *
304 304
      * @return bool true if the InputOption object exists, false otherwise
305 305
      */
306
-    public function hasShortcut(string $name)
306
+    public function hasShortcut( string $name )
307 307
     {
308
-        return isset($this->shortcuts[$name]);
308
+        return isset( $this->shortcuts[ $name ] );
309 309
     }
310 310
 
311 311
     /**
312 312
      * Returns true if an InputOption object exists by negated name.
313 313
      */
314
-    public function hasNegation(string $name): bool
314
+    public function hasNegation( string $name ): bool
315 315
     {
316
-        return isset($this->negations[$name]);
316
+        return isset( $this->negations[ $name ] );
317 317
     }
318 318
 
319 319
     /**
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
      *
322 322
      * @return InputOption An InputOption object
323 323
      */
324
-    public function getOptionForShortcut(string $shortcut)
324
+    public function getOptionForShortcut( string $shortcut )
325 325
     {
326
-        return $this->getOption($this->shortcutToName($shortcut));
326
+        return $this->getOption( $this->shortcutToName( $shortcut ) );
327 327
     }
328 328
 
329 329
     /**
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
      */
332 332
     public function getOptionDefaults()
333 333
     {
334
-        $values = [];
335
-        foreach ($this->options as $option) {
336
-            $values[$option->getName()] = $option->getDefault();
334
+        $values = [ ];
335
+        foreach ( $this->options as $option ) {
336
+            $values[ $option->getName() ] = $option->getDefault();
337 337
         }
338 338
 
339 339
         return $values;
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
      *
347 347
      * @internal
348 348
      */
349
-    public function shortcutToName(string $shortcut): string
349
+    public function shortcutToName( string $shortcut ): string
350 350
     {
351
-        if (!isset($this->shortcuts[$shortcut])) {
352
-            throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
351
+        if ( ! isset( $this->shortcuts[ $shortcut ] ) ) {
352
+            throw new InvalidArgumentException( sprintf( 'The "-%s" option does not exist.', $shortcut ) );
353 353
         }
354 354
 
355
-        return $this->shortcuts[$shortcut];
355
+        return $this->shortcuts[ $shortcut ];
356 356
     }
357 357
 
358 358
     /**
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
      *
363 363
      * @internal
364 364
      */
365
-    public function negationToName(string $negation): string
365
+    public function negationToName( string $negation ): string
366 366
     {
367
-        if (!isset($this->negations[$negation])) {
368
-            throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
367
+        if ( ! isset( $this->negations[ $negation ] ) ) {
368
+            throw new InvalidArgumentException( sprintf( 'The "--%s" option does not exist.', $negation ) );
369 369
         }
370 370
 
371
-        return $this->negations[$negation];
371
+        return $this->negations[ $negation ];
372 372
     }
373 373
 
374 374
     /**
@@ -376,49 +376,49 @@  discard block
 block discarded – undo
376 376
      *
377 377
      * @return string The synopsis
378 378
      */
379
-    public function getSynopsis(bool $short = false)
379
+    public function getSynopsis( bool $short = false )
380 380
     {
381
-        $elements = [];
381
+        $elements = [ ];
382 382
 
383
-        if ($short && $this->getOptions()) {
384
-            $elements[] = '[options]';
385
-        } elseif (!$short) {
386
-            foreach ($this->getOptions() as $option) {
383
+        if ( $short && $this->getOptions() ) {
384
+            $elements[ ] = '[options]';
385
+        } elseif ( ! $short ) {
386
+            foreach ( $this->getOptions() as $option ) {
387 387
                 $value = '';
388
-                if ($option->acceptValue()) {
388
+                if ( $option->acceptValue() ) {
389 389
                     $value = sprintf(
390 390
                         ' %s%s%s',
391 391
                         $option->isValueOptional() ? '[' : '',
392
-                        strtoupper($option->getName()),
392
+                        strtoupper( $option->getName() ),
393 393
                         $option->isValueOptional() ? ']' : ''
394 394
                     );
395 395
                 }
396 396
 
397
-                $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
398
-                $negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
399
-                $elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
397
+                $shortcut = $option->getShortcut() ? sprintf( '-%s|', $option->getShortcut() ) : '';
398
+                $negation = $option->isNegatable() ? sprintf( '|--no-%s', $option->getName() ) : '';
399
+                $elements[ ] = sprintf( '[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation );
400 400
             }
401 401
         }
402 402
 
403
-        if (\count($elements) && $this->getArguments()) {
404
-            $elements[] = '[--]';
403
+        if ( \count( $elements ) && $this->getArguments() ) {
404
+            $elements[ ] = '[--]';
405 405
         }
406 406
 
407 407
         $tail = '';
408
-        foreach ($this->getArguments() as $argument) {
409
-            $element = '<'.$argument->getName().'>';
410
-            if ($argument->isArray()) {
408
+        foreach ( $this->getArguments() as $argument ) {
409
+            $element = '<' . $argument->getName() . '>';
410
+            if ( $argument->isArray() ) {
411 411
                 $element .= '...';
412 412
             }
413 413
 
414
-            if (!$argument->isRequired()) {
415
-                $element = '['.$element;
414
+            if ( ! $argument->isRequired() ) {
415
+                $element = '[' . $element;
416 416
                 $tail .= ']';
417 417
             }
418 418
 
419
-            $elements[] = $element;
419
+            $elements[ ] = $element;
420 420
         }
421 421
 
422
-        return implode(' ', $elements).$tail;
422
+        return implode( ' ', $elements ) . $tail;
423 423
     }
424 424
 }
Please login to merge, or discard this patch.