Conditions | 1 |
Paths | 1 |
Total Lines | 146 |
Code Lines | 56 |
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 |
||
183 | public function tagDataProvider() : array |
||
184 | { |
||
185 | $packageName = uniqid('packageName', true); |
||
186 | $package = $this->createMock(PackageInterface::class); |
||
187 | |||
188 | $package->expects(self::any())->method('getName')->willReturn($packageName); |
||
189 | |||
190 | return [ |
||
191 | 'empty' => [ |
||
192 | $package, |
||
193 | '', |
||
194 | 0, |
||
195 | '', |
||
196 | false, |
||
197 | <<<'READABLE' |
||
198 | [NOT SIGNED] [NOT VERIFIED] |
||
199 | Command: |
||
200 | Exit code: 0 |
||
201 | Output: |
||
202 | READABLE |
||
203 | ], |
||
204 | 'failed verification - no signed tag' => [ |
||
205 | $package, |
||
206 | 'git tag -v --verbose unsigned-tag', |
||
207 | 1, |
||
208 | '', |
||
209 | false, |
||
210 | <<<'READABLE' |
||
211 | [NOT SIGNED] [NOT VERIFIED] |
||
212 | Command: git tag -v --verbose unsigned-tag |
||
213 | Exit code: 1 |
||
214 | Output: |
||
215 | READABLE |
||
216 | ], |
||
217 | 'failed verification - signed tag, unknown key' => [ |
||
218 | $package, |
||
219 | 'git tag -v tag-name', |
||
220 | 1, |
||
221 | <<<'OUTPUT' |
||
222 | object bf2fabeabe00f14f0ce0090adc7a2b9b770edbe3 |
||
223 | type commit |
||
224 | tag tag-name |
||
225 | tagger Mr. Magoo <[email protected]> 1495094925 +0200 |
||
226 | |||
227 | signed tag |
||
228 | gpg: keybox '/tmp/gpg-verification-test591d568c5d0947.51554486//pubring.kbx' created |
||
229 | gpg: Signature made Do 18 Mai 2017 10:08:45 CEST |
||
230 | gpg: using RSA key 4B95C0CE4DE340CC |
||
231 | gpg: Can't check signature: No public key |
||
232 | OUTPUT |
||
233 | , |
||
234 | false, |
||
235 | <<<'READABLE' |
||
236 | [SIGNED] [NOT VERIFIED] Commit #bf2fabeabe00f14f0ce0090adc7a2b9b770edbe3 Tag tag-name (Key 4B95C0CE4DE340CC) |
||
237 | Command: git tag -v tag-name |
||
238 | Exit code: 1 |
||
239 | Output: object bf2fabeabe00f14f0ce0090adc7a2b9b770edbe3 |
||
240 | type commit |
||
241 | tag tag-name |
||
242 | tagger Mr. Magoo <[email protected]> 1495094925 +0200 |
||
243 | |||
244 | signed tag |
||
245 | gpg: keybox '/tmp/gpg-verification-test591d568c5d0947.51554486//pubring.kbx' created |
||
246 | gpg: Signature made Do 18 Mai 2017 10:08:45 CEST |
||
247 | gpg: using RSA key 4B95C0CE4DE340CC |
||
248 | gpg: Can't check signature: No public key |
||
249 | READABLE |
||
250 | ], |
||
251 | 'failed verification - signed tag, untrusted key' => [ |
||
252 | $package, |
||
253 | 'git tag -v tag-name', |
||
254 | 0, |
||
255 | <<<'OUTPUT' |
||
256 | object be3b7a6f0ee4d90a72e1e1a19f89d8eeef746200 |
||
257 | type commit |
||
258 | tag tag-name |
||
259 | tagger Mr. Magoo <[email protected]> 1495095245 +0200 |
||
260 | |||
261 | signed tag |
||
262 | gpg: Signature made Do 18 Mai 2017 10:14:05 CEST |
||
263 | gpg: using RSA key 865E20A60B500B00 |
||
264 | gpg: checking the trustdb |
||
265 | gpg: marginals needed: 3 completes needed: 1 trust model: pgp |
||
266 | gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u |
||
267 | gpg: Good signature from "Mr. Magoo <[email protected]>" [unknown] |
||
268 | gpg: WARNING: This key is not certified with a trusted signature! |
||
269 | gpg: There is no indication that the signature belongs to the owner. |
||
270 | Primary key fingerprint: D8BE 3E96 4271 2378 9551 AF87 865E 20A6 0B50 0B00 |
||
271 | OUTPUT |
||
272 | , |
||
273 | false, |
||
274 | <<<'READABLE' |
||
275 | [SIGNED] [NOT VERIFIED] Commit #be3b7a6f0ee4d90a72e1e1a19f89d8eeef746200 Tag tag-name By "Mr. Magoo <[email protected]>" (Key 865E20A60B500B00) |
||
276 | Command: git tag -v tag-name |
||
277 | Exit code: 0 |
||
278 | Output: object be3b7a6f0ee4d90a72e1e1a19f89d8eeef746200 |
||
279 | type commit |
||
280 | tag tag-name |
||
281 | tagger Mr. Magoo <[email protected]> 1495095245 +0200 |
||
282 | |||
283 | signed tag |
||
284 | gpg: Signature made Do 18 Mai 2017 10:14:05 CEST |
||
285 | gpg: using RSA key 865E20A60B500B00 |
||
286 | gpg: checking the trustdb |
||
287 | gpg: marginals needed: 3 completes needed: 1 trust model: pgp |
||
288 | gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u |
||
289 | gpg: Good signature from "Mr. Magoo <[email protected]>" [unknown] |
||
290 | gpg: WARNING: This key is not certified with a trusted signature! |
||
291 | gpg: There is no indication that the signature belongs to the owner. |
||
292 | Primary key fingerprint: D8BE 3E96 4271 2378 9551 AF87 865E 20A6 0B50 0B00 |
||
293 | READABLE |
||
294 | ], |
||
295 | 'successful verification' => [ |
||
296 | $package, |
||
297 | 'git tag -v tag-name', |
||
298 | 0, |
||
299 | <<<'OUTPUT' |
||
300 | object 99498872c90de4d40b2fcafad7bd1bb2cbd0433a |
||
301 | type commit |
||
302 | tag tag-name |
||
303 | tagger Mr. Magoo <[email protected]> 1495095451 +0200 |
||
304 | |||
305 | signed tag |
||
306 | gpg: Signature made Do 18 Mai 2017 10:17:31 CEST |
||
307 | gpg: using RSA key E9AE0662BC840E1F |
||
308 | gpg: Good signature from "Mr. Magoo <[email protected]>" [full] |
||
309 | OUTPUT |
||
310 | , |
||
311 | true, |
||
312 | <<<'READABLE' |
||
313 | [SIGNED] [VERIFIED] Commit #99498872c90de4d40b2fcafad7bd1bb2cbd0433a Tag tag-name By "Mr. Magoo <[email protected]>" (Key E9AE0662BC840E1F) |
||
314 | Command: git tag -v tag-name |
||
315 | Exit code: 0 |
||
316 | Output: object 99498872c90de4d40b2fcafad7bd1bb2cbd0433a |
||
317 | type commit |
||
318 | tag tag-name |
||
319 | tagger Mr. Magoo <[email protected]> 1495095451 +0200 |
||
320 | |||
321 | signed tag |
||
322 | gpg: Signature made Do 18 Mai 2017 10:17:31 CEST |
||
323 | gpg: using RSA key E9AE0662BC840E1F |
||
324 | gpg: Good signature from "Mr. Magoo <[email protected]>" [full] |
||
325 | READABLE |
||
326 | ], |
||
327 | ]; |
||
328 | } |
||
329 | } |
||
330 |