| Conditions | 5 | 
| Total Lines | 59 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 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 | ||
| 84 |     { | ||
| 85 | $io = new SymfonyStyle($input, $output); | ||
| 86 | |||
| 87 | (new PhpSettingsHandler(new ConsoleLogger($output)))->check(); | ||
| 88 | |||
| 89 | $paths = [ | ||
| 90 | $input->getArgument(self::FIRST_PHAR_ARG), | ||
| 91 | $input->getArgument(self::SECOND_PHAR_ARG), | ||
| 92 | ]; | ||
| 93 | |||
| 94 | Assertion::allFile($paths); | ||
| 1 ignored issue–
                            show | |||
| 95 | |||
| 96 |         try { | ||
| 97 | $diff = new PharDiff( | ||
| 98 | ...array_map( | ||
| 99 |                     function (string $path): Pharaoh { | ||
| 100 | $path = false !== realpath($path) ? realpath($path) : $path; | ||
| 101 | |||
| 102 | return new Pharaoh($path); | ||
| 103 | }, | ||
| 104 | $paths | ||
| 105 | ) | ||
| 106 | ); | ||
| 107 | $diff->setVerbose(true); | ||
| 108 |         } catch (Throwable $throwable) { | ||
| 109 |             if ($output->isDebug()) { | ||
| 110 | throw $throwable; | ||
| 111 | } | ||
| 112 | |||
| 113 | $io->writeln( | ||
| 114 | sprintf( | ||
| 115 | '<error>Could not check the PHARs: %s</error>', | ||
| 116 | $throwable->getMessage() | ||
| 117 | ) | ||
| 118 | ); | ||
| 119 | |||
| 120 | return 1; | ||
| 121 | } | ||
| 122 | |||
| 123 |         if ($input->hasParameterOption(['-c', '--check'])) { | ||
| 124 | return $diff->listChecksums($input->getOption(self::CHECK_OPTION) ?? 'sha384'); | ||
| 125 | } | ||
| 126 | |||
| 127 |         if ($input->getOption(self::GNU_DIFF_OPTION)) { | ||
| 128 | return $diff->printGnuDiff(); | ||
| 129 | } | ||
| 130 | |||
| 131 | return $diff->printGitDiff(); | ||
| 132 | } | ||
| 133 | } | ||
| 134 |