Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Code Lines | 44 |
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 | 'Set output format (default or json)', |
||
50 | 'default' |
||
51 | ) |
||
52 | ->addOption( |
||
53 | 'flagged-only', |
||
54 | null, |
||
55 | InputOption::VALUE_NONE, |
||
56 | 'Test only examples flagged with the @example annotation' |
||
57 | ) |
||
58 | ->addOption( |
||
59 | 'ignore-unknown-annotations', |
||
60 | null, |
||
61 | InputOption::VALUE_NONE, |
||
62 | 'Ignore example annotations that are not known to readme-tester' |
||
63 | ) |
||
64 | ->addOption( |
||
65 | 'runner', |
||
66 | null, |
||
67 | InputOption::VALUE_REQUIRED, |
||
68 | 'Specify the example runner to use (process or eval)', |
||
69 | 'process' |
||
70 | ) |
||
71 | ->addOption( |
||
72 | 'bootstrap', |
||
73 | null, |
||
74 | InputOption::VALUE_REQUIRED, |
||
75 | 'A "bootstrap" PHP file that is run before testing' |
||
76 | ) |
||
77 | ->addOption( |
||
78 | 'no-auto-bootstrap', |
||
79 | null, |
||
80 | InputOption::VALUE_NONE, |
||
81 | "Don't try to load a local composer autoloader when boostrap is not definied" |
||
82 | ) |
||
157 |