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