| Conditions | 24 |
| Paths | 900 |
| Total Lines | 78 |
| Code Lines | 57 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 165 | private function configureIO(InputInterface $input, OutputInterface $output): void |
||
| 166 | { |
||
| 167 | if (true === $input->hasParameterOption(['--ansi'], true)) { |
||
| 168 | $output->setDecorated(true); |
||
| 169 | } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) { |
||
| 170 | $output->setDecorated(false); |
||
| 171 | } |
||
| 172 | |||
| 173 | if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) { |
||
| 174 | $input->setInteractive(false); |
||
| 175 | } elseif (\function_exists('posix_isatty')) { |
||
| 176 | $inputStream = null; |
||
| 177 | |||
| 178 | if ($input instanceof StreamableInputInterface) { |
||
| 179 | $inputStream = $input->getStream(); |
||
| 180 | } |
||
| 181 | |||
| 182 | if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { |
||
| 183 | $input->setInteractive(false); |
||
| 184 | } |
||
| 185 | } |
||
| 186 | |||
| 187 | switch ($shellVerbosity = (int)getenv('SHELL_VERBOSITY')) { |
||
| 188 | case -1: |
||
| 189 | $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); |
||
| 190 | break; |
||
| 191 | case 1: |
||
| 192 | $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); |
||
| 193 | break; |
||
| 194 | case 2: |
||
| 195 | $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); |
||
| 196 | break; |
||
| 197 | case 3: |
||
| 198 | $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); |
||
| 199 | break; |
||
| 200 | default: |
||
| 201 | $shellVerbosity = 0; |
||
| 202 | break; |
||
| 203 | } |
||
| 204 | |||
| 205 | if ( |
||
| 206 | true === $input->hasParameterOption(['--quiet', '-q'], true) |
||
| 207 | ) { |
||
| 208 | $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); |
||
| 209 | $shellVerbosity = -1; |
||
| 210 | } else { |
||
| 211 | if ( |
||
| 212 | $input->hasParameterOption('-vvv', true) |
||
| 213 | || $input->hasParameterOption('--verbose=3', true) |
||
| 214 | || 3 === $input->getParameterOption('--verbose', false, true) |
||
| 215 | ) { |
||
| 216 | $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); |
||
| 217 | $shellVerbosity = 3; |
||
| 218 | } elseif ( |
||
| 219 | $input->hasParameterOption('-vv', true) |
||
| 220 | || $input->hasParameterOption('--verbose=2', true) |
||
| 221 | || 2 === $input->getParameterOption('--verbose', false, true) |
||
| 222 | ) { |
||
| 223 | $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); |
||
| 224 | $shellVerbosity = 2; |
||
| 225 | } elseif ( |
||
| 226 | $input->hasParameterOption('-v', true) |
||
| 227 | || $input->hasParameterOption('--verbose=1', true) |
||
| 228 | || $input->hasParameterOption('--verbose', true) |
||
| 229 | || $input->getParameterOption('--verbose', false, true) |
||
| 230 | ) { |
||
| 231 | $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); |
||
| 232 | $shellVerbosity = 1; |
||
| 233 | } |
||
| 234 | } |
||
| 235 | |||
| 236 | if (-1 === $shellVerbosity) { |
||
| 237 | $input->setInteractive(false); |
||
| 238 | } |
||
| 239 | |||
| 240 | putenv('SHELL_VERBOSITY=' . $shellVerbosity); |
||
| 241 | $_ENV['SHELL_VERBOSITY'] = $shellVerbosity; |
||
| 242 | $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; |
||
| 243 | } |
||
| 245 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.