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