| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 42 |
| 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 |
||
| 29 | protected function configure() |
||
| 30 | { |
||
| 31 | $this->setName('test') |
||
| 32 | ->setDescription('Test examples in readme file') |
||
| 33 | ->addArgument( |
||
| 34 | 'source', |
||
| 35 | InputArgument::OPTIONAL | InputArgument::IS_ARRAY, |
||
| 36 | 'One or more files or directories to test', |
||
| 37 | ['README.md'] |
||
| 38 | ) |
||
| 39 | ->addOption( |
||
| 40 | 'filter', |
||
| 41 | null, |
||
| 42 | InputOption::VALUE_REQUIRED, |
||
| 43 | 'Filter which examples to test using a regular expression' |
||
| 44 | ) |
||
| 45 | ->addOption( |
||
| 46 | 'format', |
||
| 47 | null, |
||
| 48 | InputOption::VALUE_REQUIRED, |
||
| 49 | "One of 'std' or 'json'" |
||
| 50 | ) |
||
| 51 | ->addOption( |
||
| 52 | 'named-only', |
||
| 53 | null, |
||
| 54 | InputOption::VALUE_NONE, |
||
| 55 | 'Test only named examples' |
||
| 56 | ) |
||
| 57 | ->addOption( |
||
| 58 | 'ignore-unknown-annotations', |
||
| 59 | null, |
||
| 60 | InputOption::VALUE_NONE, |
||
| 61 | 'Ignore example annotations that are not known to readme-tester' |
||
| 62 | ) |
||
| 63 | ->addOption( |
||
| 64 | 'isolation', |
||
| 65 | null, |
||
| 66 | InputOption::VALUE_NONE, |
||
| 67 | 'Run tests in isolation' |
||
| 68 | ) |
||
| 69 | ->addOption( |
||
| 70 | 'bootstrap', |
||
| 71 | null, |
||
| 72 | InputOption::VALUE_REQUIRED, |
||
| 73 | 'A "bootstrap" PHP file that is run before testing' |
||
| 74 | ) |
||
| 75 | ->addOption( |
||
| 76 | 'no-auto-bootstrap', |
||
| 77 | null, |
||
| 78 | InputOption::VALUE_NONE, |
||
| 79 | "Don't try to load a local composer autoloader when boostrap is not definied" |
||
| 80 | ) |
||
| 144 |