Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
Code Lines | 44 |
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 |
||
26 | protected function configure() |
||
27 | { |
||
28 | $this |
||
29 | ->setName('phpmnd') |
||
30 | ->setDefinition( |
||
31 | [ |
||
32 | new InputArgument( |
||
33 | 'directory', |
||
34 | InputArgument::REQUIRED, |
||
35 | 'Directory to analyze' |
||
36 | ) |
||
37 | ] |
||
38 | ) |
||
39 | ->addOption( |
||
40 | 'extensions', |
||
41 | null, |
||
42 | InputOption::VALUE_REQUIRED, |
||
43 | 'A comma-separated list of extensions', |
||
44 | [] |
||
45 | ) |
||
46 | ->addOption( |
||
47 | 'ignore-numbers', |
||
48 | null, |
||
49 | InputOption::VALUE_REQUIRED, |
||
50 | 'A comma-separated list of numbers to ignore', |
||
51 | [0, 1] |
||
52 | ) |
||
53 | ->addOption( |
||
54 | 'ignore-funcs', |
||
55 | null, |
||
56 | InputOption::VALUE_REQUIRED, |
||
57 | 'A comma-separated list of functions to ignore when using "argument" extension', |
||
58 | [] |
||
59 | ) |
||
60 | ->addOption( |
||
61 | 'exclude', |
||
62 | null, |
||
63 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
64 | 'Exclude a directory from code analysis (must be relative to source)' |
||
65 | ) |
||
66 | ->addOption( |
||
67 | 'exclude-path', |
||
68 | null, |
||
69 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
70 | 'Exclude a path from code analysis (must be relative to source)' |
||
71 | ) |
||
72 | ->addOption( |
||
73 | 'exclude-file', |
||
74 | null, |
||
75 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
76 | 'Exclude a file from code analysis (must be relative to source)' |
||
77 | ) |
||
78 | ->addOption( |
||
79 | 'progress', |
||
80 | null, |
||
81 | InputOption::VALUE_NONE, |
||
82 | 'Show progress bar' |
||
83 | ); |
||
84 | } |
||
85 | |||
193 |