| Conditions | 1 |
| Paths | 1 |
| Total Lines | 61 |
| Code Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 38 | public function createValidatorProvider(): array |
||
| 39 | { |
||
| 40 | return [ |
||
| 41 | 'empty-data' => [ |
||
| 42 | [], |
||
| 43 | false, |
||
| 44 | ], |
||
| 45 | 'valid-data' => [ |
||
| 46 | [ |
||
| 47 | 'user_id' => '465c91df-9cc7-47e2-a2ef-8fe645753148', |
||
| 48 | 'file_id' => '69da7b0b-8315-43c9-8f5d-a6a5ea09b051', |
||
| 49 | ], |
||
| 50 | true, |
||
| 51 | ], |
||
| 52 | 'invalid-user-id-present' => [ |
||
| 53 | [ |
||
| 54 | 'id' => '465c91df-9cc7-47e2-a2ef-8fe64575314', |
||
| 55 | 'user_id' => '465c91df-9cc7-47e2-a2ef-8fe64575314', |
||
| 56 | 'file_id' => '69da7b0b-8315-43c9-8f5d-a6a5ea09b051', |
||
| 57 | ], |
||
| 58 | false, |
||
| 59 | ], |
||
| 60 | 'invalid-user-id-not-uuid' => [ |
||
| 61 | [ |
||
| 62 | 'user_id' => '465c91df-9cc7-47e2-a2ef-8fe64575314', |
||
| 63 | 'file_id' => '69da7b0b-8315-43c9-8f5d-a6a5ea09b051', |
||
| 64 | ], |
||
| 65 | false, |
||
| 66 | ], |
||
| 67 | 'invalid-user-id-missing' => [ |
||
| 68 | [ |
||
| 69 | 'file_id' => '69da7b0b-8315-43c9-8f5d-a6a5ea09b051', |
||
| 70 | ], |
||
| 71 | false, |
||
| 72 | ], |
||
| 73 | 'invalid-user-id-empty' => [ |
||
| 74 | [ |
||
| 75 | 'user_id' => '', |
||
| 76 | 'file_id' => '69da7b0b-8315-43c9-8f5d-a6a5ea09b051', |
||
| 77 | ], |
||
| 78 | false, |
||
| 79 | ], |
||
| 80 | 'invalid-file-id-not-uuid' => [ |
||
| 81 | [ |
||
| 82 | 'user_id' => '465c91df-9cc7-47e2-a2ef-8fe645753148', |
||
| 83 | 'file_id' => '69da7b0b-8315-43c9-8f5d-a6a5ea09b05', |
||
| 84 | ], |
||
| 85 | false, |
||
| 86 | ], |
||
| 87 | 'invalid-file-missing' => [ |
||
| 88 | [ |
||
| 89 | 'user_id' => '465c91df-9cc7-47e2-a2ef-8fe645753148', |
||
| 90 | ], |
||
| 91 | false, |
||
| 92 | ], |
||
| 93 | 'invalid-file-empty' => [ |
||
| 94 | [ |
||
| 95 | 'user_id' => '465c91df-9cc7-47e2-a2ef-8fe645753148', |
||
| 96 | 'file_id' => '', |
||
| 97 | ], |
||
| 98 | false, |
||
| 99 | ], |
||
| 120 |