| Conditions | 1 |
| Paths | 1 |
| Total Lines | 91 |
| Code Lines | 70 |
| 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 |
||
| 28 | protected function configure() |
||
| 29 | { |
||
| 30 | $this |
||
| 31 | ->setName('phpmnd') |
||
| 32 | ->setDefinition( |
||
| 33 | [ |
||
| 34 | new InputArgument( |
||
| 35 | 'directory', |
||
| 36 | InputArgument::REQUIRED, |
||
| 37 | 'Directory to analyze' |
||
| 38 | ) |
||
| 39 | ] |
||
| 40 | ) |
||
| 41 | ->addOption( |
||
| 42 | 'extensions', |
||
| 43 | null, |
||
| 44 | InputOption::VALUE_REQUIRED, |
||
| 45 | 'A comma-separated list of extensions', |
||
| 46 | [] |
||
| 47 | ) |
||
| 48 | ->addOption( |
||
| 49 | 'ignore-numbers', |
||
| 50 | null, |
||
| 51 | InputOption::VALUE_REQUIRED, |
||
| 52 | 'A comma-separated list of numbers to ignore', |
||
| 53 | [0, 1] |
||
| 54 | ) |
||
| 55 | ->addOption( |
||
| 56 | 'ignore-funcs', |
||
| 57 | null, |
||
| 58 | InputOption::VALUE_REQUIRED, |
||
| 59 | 'A comma-separated list of functions to ignore when using "argument" extension', |
||
| 60 | [] |
||
| 61 | ) |
||
| 62 | ->addOption( |
||
| 63 | 'exclude', |
||
| 64 | null, |
||
| 65 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 66 | 'Exclude a directory from code analysis (must be relative to source)' |
||
| 67 | ) |
||
| 68 | ->addOption( |
||
| 69 | 'exclude-path', |
||
| 70 | null, |
||
| 71 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 72 | 'Exclude a path from code analysis (must be relative to source)' |
||
| 73 | ) |
||
| 74 | ->addOption( |
||
| 75 | 'exclude-file', |
||
| 76 | null, |
||
| 77 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 78 | 'Exclude a file from code analysis (must be relative to source)' |
||
| 79 | ) |
||
| 80 | ->addOption( |
||
| 81 | 'suffixes', |
||
| 82 | null, |
||
| 83 | InputOption::VALUE_REQUIRED, |
||
| 84 | 'Comma-separated string of valid source code filename extensions', |
||
| 85 | 'php' |
||
| 86 | ) |
||
| 87 | ->addOption( |
||
| 88 | 'progress', |
||
| 89 | null, |
||
| 90 | InputOption::VALUE_NONE, |
||
| 91 | 'Show progress bar' |
||
| 92 | ) |
||
| 93 | ->addOption( |
||
| 94 | 'hint', |
||
| 95 | null, |
||
| 96 | InputOption::VALUE_NONE, |
||
| 97 | 'Suggest replacements for magic numbers' |
||
| 98 | ) |
||
| 99 | ->addOption( |
||
| 100 | 'non-zero-exit-on-violation', |
||
| 101 | null, |
||
| 102 | InputOption::VALUE_NONE, |
||
| 103 | 'Return a non zero exit code when there are magic numbers' |
||
| 104 | ) |
||
| 105 | ->addOption( |
||
| 106 | 'strings', |
||
| 107 | null, |
||
| 108 | InputOption::VALUE_NONE, |
||
| 109 | 'Include strings literal search in code analysis' |
||
| 110 | ) |
||
| 111 | ->addOption( |
||
| 112 | 'ignore-strings', |
||
| 113 | null, |
||
| 114 | InputOption::VALUE_REQUIRED, |
||
| 115 | 'A comma-separated list of strings to ignore when using "strings" option', |
||
| 116 | [] |
||
| 117 | ); |
||
| 118 | } |
||
| 119 | |||
| 239 |