| Conditions | 1 |
| Paths | 1 |
| Total Lines | 54 |
| Code Lines | 37 |
| 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 |
||
| 16 | protected function configure() |
||
| 17 | { |
||
| 18 | $this->setName('changelog:version'); |
||
| 19 | |||
| 20 | $this->setDescription( |
||
| 21 | 'Display version information from changelog. <comment>[default: latest stable]</comment>' |
||
| 22 | ); |
||
| 23 | |||
| 24 | $this->addArgument( |
||
| 25 | 'name', |
||
| 26 | \Symfony\Component\Console\Input\InputArgument::OPTIONAL, |
||
| 27 | 'Targeted package name. Default: root package' |
||
| 28 | ); |
||
| 29 | |||
| 30 | $this->addOption( |
||
| 31 | '--from-source', |
||
| 32 | null, |
||
| 33 | \Symfony\Component\Console\Input\InputOption::VALUE_NONE, |
||
| 34 | 'Extract configuration from vendor package instead of using global installation data' |
||
| 35 | ); |
||
| 36 | |||
| 37 | $this->addOption( |
||
| 38 | '--format', |
||
| 39 | null, |
||
| 40 | \Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, |
||
| 41 | 'Format of the output (regex)' |
||
| 42 | ); |
||
| 43 | |||
| 44 | $this->addOption( |
||
| 45 | '--segments', |
||
| 46 | null, |
||
| 47 | \Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, |
||
| 48 | 'Number of segments of the version to return. <comment>[default: all segments]</comment>' |
||
| 49 | ); |
||
| 50 | |||
| 51 | $this->addOption( |
||
| 52 | '--upcoming', |
||
| 53 | null, |
||
| 54 | \Symfony\Component\Console\Input\InputOption::VALUE_NONE, |
||
| 55 | 'Show upcoming version (if there is one)' |
||
| 56 | ); |
||
| 57 | |||
| 58 | $this->addOption( |
||
| 59 | '--branch', |
||
| 60 | null, |
||
| 61 | \Symfony\Component\Console\Input\InputOption::VALUE_OPTIONAL, |
||
| 62 | 'Match release branch (if provided in changelog item)' |
||
| 63 | ); |
||
| 64 | |||
| 65 | $this->addOption( |
||
| 66 | '--tip', |
||
| 67 | null, |
||
| 68 | \Symfony\Component\Console\Input\InputOption::VALUE_NONE, |
||
| 69 | 'Show LATEST version (might be latest release, might be upcoming)' |
||
| 70 | ); |
||
| 173 |