Conditions | 1 |
Paths | 1 |
Total Lines | 91 |
Code Lines | 75 |
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 |
||
45 | public function configure(Command $command): void |
||
46 | { |
||
47 | $command |
||
48 | ->addArgument( |
||
49 | self::PATHS_ARGUMENT, |
||
50 | InputArgument::OPTIONAL | InputArgument::IS_ARRAY, |
||
51 | 'One or more paths to scan for test files' |
||
52 | ) |
||
53 | ->addOption( |
||
54 | self::CONFIG_FILE_OPTION, |
||
55 | 'c', |
||
56 | InputOption::VALUE_REQUIRED, |
||
57 | 'Read configurations from file' |
||
58 | ) |
||
59 | ->addOption( |
||
60 | self::NO_CONFIG_OPTION, |
||
61 | null, |
||
62 | InputOption::VALUE_NONE, |
||
63 | 'Do not load a configuration file' |
||
64 | ) |
||
65 | ->addOption( |
||
66 | self::SUITE_OPTION, |
||
67 | null, |
||
68 | InputOption::VALUE_REQUIRED, |
||
69 | 'Execute named suite' |
||
70 | ) |
||
71 | ->addOption( |
||
72 | self::FILE_EXTENSIONS_OPTION, |
||
73 | null, |
||
74 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
75 | 'File extension to use while scanning for test files' |
||
76 | ) |
||
77 | ->addOption( |
||
78 | self::IGNORE_PATHS_OPTION, |
||
79 | null, |
||
80 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
81 | 'Path to ignore while scanning for test files' |
||
82 | ) |
||
83 | ->addOption( |
||
84 | self::STDIN_OPTION, |
||
85 | null, |
||
86 | InputOption::VALUE_NONE, |
||
87 | 'Read from stdin instead of scaning the filesystem' |
||
88 | ) |
||
89 | ->addOption( |
||
90 | self::OUTPUT_OPTION, |
||
91 | null, |
||
92 | InputOption::VALUE_REQUIRED, |
||
93 | 'Set output format (' . Configs::describe(Configs::OUTPUT_ID) . ')' |
||
94 | ) |
||
95 | ->addOption( |
||
96 | self::DEBUG_OPTION, |
||
97 | null, |
||
98 | InputOption::VALUE_NONE, |
||
99 | 'View debug info on generated examples (shorthand for --output debug)' |
||
100 | ) |
||
101 | ->addOption( |
||
102 | self::INPUT_OPTION, |
||
103 | null, |
||
104 | InputOption::VALUE_REQUIRED, |
||
105 | 'Set input format (' . Configs::describe(Configs::INPUT_ID) . ')' |
||
106 | ) |
||
107 | ->addOption( |
||
108 | self::RUNNER_OPTION, |
||
109 | null, |
||
110 | InputOption::VALUE_REQUIRED, |
||
111 | 'Set example runner (' . Configs::describe(Configs::RUNNER_ID) . ')' |
||
112 | ) |
||
113 | ->addOption( |
||
114 | self::BOOTSTRAP_OPTION, |
||
115 | null, |
||
116 | InputOption::VALUE_REQUIRED, |
||
117 | 'A "bootstrap" PHP file that is included before testing' |
||
118 | ) |
||
119 | ->addOption( |
||
120 | self::NO_BOOTSTRAP_OPTION, |
||
121 | null, |
||
122 | InputOption::VALUE_NONE, |
||
123 | "Ignore bootstrapping" |
||
124 | ) |
||
125 | ->addOption( |
||
126 | self::STOP_ON_FAILURE_OPTION, |
||
127 | 's', |
||
128 | InputOption::VALUE_NONE, |
||
129 | "Stop processing on first failed test" |
||
130 | ) |
||
131 | ->addOption( |
||
132 | self::FILTER_OPTION, |
||
133 | null, |
||
134 | InputOption::VALUE_REQUIRED, |
||
135 | "Filter which examples to test" |
||
136 | ) |
||
275 |