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