Conditions | 1 |
Paths | 1 |
Total Lines | 90 |
Code Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 |
||
73 | public function provideOptions(): Generator |
||
74 | { |
||
75 | yield [ |
||
76 | ['cli.php', '--foo'], |
||
77 | self::getDefaultInteractive(), |
||
78 | IO::VERBOSITY_NORMAL, |
||
79 | ]; |
||
80 | |||
81 | yield [ |
||
82 | ['cli.php', '--foo', '--verbose=0'], |
||
83 | self::getDefaultInteractive(), |
||
84 | IO::VERBOSITY_VERBOSE, |
||
85 | ]; |
||
86 | |||
87 | yield [ |
||
88 | ['cli.php', '--foo', '--quiet'], |
||
89 | false, |
||
90 | IO::VERBOSITY_QUIET, |
||
91 | ]; |
||
92 | |||
93 | yield [ |
||
94 | ['cli.php', '--foo', '-q'], |
||
95 | false, |
||
96 | IO::VERBOSITY_QUIET, |
||
97 | ]; |
||
98 | |||
99 | yield [ |
||
100 | ['cli.php', '--foo', '-vvv'], |
||
101 | self::getDefaultInteractive(), |
||
102 | IO::VERBOSITY_DEBUG, |
||
103 | ]; |
||
104 | |||
105 | yield [ |
||
106 | ['cli.php', '--foo', '--verbose=3'], |
||
107 | self::getDefaultInteractive(), |
||
108 | IO::VERBOSITY_DEBUG, |
||
109 | ]; |
||
110 | |||
111 | yield [ |
||
112 | ['cli.php', '--foo', '--verbose 3'], |
||
113 | self::getDefaultInteractive(), |
||
114 | IO::VERBOSITY_DEBUG, |
||
115 | ]; |
||
116 | |||
117 | yield [ |
||
118 | ['cli.php', '--foo', '-vv'], |
||
119 | self::getDefaultInteractive(), |
||
120 | IO::VERBOSITY_VERY_VERBOSE, |
||
121 | ]; |
||
122 | |||
123 | yield [ |
||
124 | ['cli.php', '--foo', '--verbose=2'], |
||
125 | self::getDefaultInteractive(), |
||
126 | IO::VERBOSITY_VERY_VERBOSE, |
||
127 | ]; |
||
128 | |||
129 | yield [ |
||
130 | ['cli.php', '--foo', '--verbose 2'], |
||
131 | self::getDefaultInteractive(), |
||
132 | IO::VERBOSITY_VERY_VERBOSE, |
||
133 | ]; |
||
134 | |||
135 | yield [ |
||
136 | ['cli.php', '--foo', '-v'], |
||
137 | self::getDefaultInteractive(), |
||
138 | IO::VERBOSITY_VERBOSE, |
||
139 | ]; |
||
140 | |||
141 | yield [ |
||
142 | ['cli.php', '--foo', '--verbose=1'], |
||
143 | self::getDefaultInteractive(), |
||
144 | IO::VERBOSITY_VERBOSE, |
||
145 | ]; |
||
146 | |||
147 | yield [ |
||
148 | ['cli.php', '--foo', '--verbose '], |
||
149 | self::getDefaultInteractive(), |
||
150 | IO::VERBOSITY_VERBOSE, |
||
151 | ]; |
||
152 | |||
153 | yield [ |
||
154 | ['cli.php', '--no-interaction'], |
||
155 | false, |
||
156 | IO::VERBOSITY_NORMAL, |
||
157 | ]; |
||
158 | |||
159 | yield [ |
||
160 | ['cli.php', '-n'], |
||
161 | false, |
||
162 | IO::VERBOSITY_NORMAL, |
||
163 | ]; |
||
204 |