| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 56 | 
| Code Lines | 45 | 
| 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 | ||
| 18 | protected function configure() | ||
| 19 |     { | ||
| 20 |         $this->setName('scan') | ||
| 21 |             ->setDescription('Check the http status code of all links on a website.') | ||
| 22 | ->addArgument( | ||
| 23 | 'url', | ||
| 24 | InputArgument::REQUIRED, | ||
| 25 | 'The url to check' | ||
| 26 | ) | ||
| 27 | ->addOption( | ||
| 28 | 'concurrency', | ||
| 29 | 'c', | ||
| 30 | InputOption::VALUE_REQUIRED, | ||
| 31 | 'The amount of concurrent connections to use', | ||
| 32 | 10 | ||
| 33 | ) | ||
| 34 | ->addOption( | ||
| 35 | 'output', | ||
| 36 | 'o', | ||
| 37 | InputOption::VALUE_REQUIRED, | ||
| 38 | 'Log all non-2xx and non-3xx responses in this file' | ||
| 39 | ) | ||
| 40 | ->addOption( | ||
| 41 | 'dont-crawl-external-links', | ||
| 42 | 'x', | ||
| 43 | InputOption::VALUE_NONE, | ||
| 44 | 'Dont crawl external links' | ||
| 45 | ) | ||
| 46 | ->addOption( | ||
| 47 | 'timeout', | ||
| 48 | 't', | ||
| 49 | InputOption::VALUE_OPTIONAL, | ||
| 50 | 'The maximum number of seconds the request can take', | ||
| 51 | 10 | ||
| 52 | ) | ||
| 53 | ->addOption( | ||
| 54 | 'user-agent', | ||
| 55 | 'u', | ||
| 56 | InputOption::VALUE_OPTIONAL, | ||
| 57 | 'The User Agent to pass for the request', | ||
| 58 | '' | ||
| 59 | ) | ||
| 60 | ->addOption( | ||
| 61 | 'skip-verification', | ||
| 62 | 's', | ||
| 63 | InputOption::VALUE_NONE, | ||
| 64 | 'Skips checking the SSL certificate' | ||
| 65 | ) | ||
| 66 | ->addOption( | ||
| 67 | 'options', | ||
| 68 | 'opt', | ||
| 69 | InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, | ||
| 70 | 'Additional options to the request', | ||
| 71 | [] | ||
| 72 | ); | ||
| 73 | } | ||
| 74 | |||
| 131 |