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