| Conditions | 1 |
| Paths | 1 |
| Total Lines | 144 |
| Code Lines | 100 |
| 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 |
||
| 39 | public function createValidatorExistingProvider(): array |
||
| 40 | { |
||
| 41 | return [ |
||
| 42 | 'empty-data' => [ |
||
| 43 | [], |
||
| 44 | false, |
||
| 45 | ], |
||
| 46 | 'valid-data' => [ |
||
| 47 | [ |
||
| 48 | 'username' => 'foo', |
||
| 49 | 'email' => '[email protected]', |
||
| 50 | 'user_group_ids' => [ |
||
| 51 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 52 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 53 | ], |
||
| 54 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 55 | 'password' => 'foo', |
||
| 56 | 'password_confirmed' => 'foo', |
||
| 57 | ], |
||
| 58 | true, |
||
| 59 | ], |
||
| 60 | 'valid-data-missing-all-not-required' => [ |
||
| 61 | [ |
||
| 62 | 'username' => 'foo', |
||
| 63 | 'email' => '[email protected]', |
||
| 64 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 65 | ], |
||
| 66 | true, |
||
| 67 | ], |
||
| 68 | 'invalid-has-id' => [ |
||
| 69 | [ |
||
| 70 | 'id' => '465c91df-9cc7-47e2-a2ef-8fe645753148', |
||
| 71 | 'username' => 'foo', |
||
| 72 | 'email' => '[email protected]', |
||
| 73 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 74 | ], |
||
| 75 | false, |
||
| 76 | ], |
||
| 77 | 'invalid-username-missing' => [ |
||
| 78 | [ |
||
| 79 | 'username' => '', |
||
| 80 | 'email' => '[email protected]', |
||
| 81 | 'user_group_ids' => [ |
||
| 82 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 83 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 84 | ], |
||
| 85 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 86 | 'password' => 'foo', |
||
| 87 | 'password_confirmed' => 'foo', |
||
| 88 | ], |
||
| 89 | false, |
||
| 90 | ], |
||
| 91 | 'invalid-email-not-valid' => [ |
||
| 92 | [ |
||
| 93 | 'username' => 'foo', |
||
| 94 | 'email' => 'user@@example.com', |
||
| 95 | 'user_group_ids' => [ |
||
| 96 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 97 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 98 | ], |
||
| 99 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 100 | 'password' => 'foo', |
||
| 101 | 'password_confirmed' => 'foo', |
||
| 102 | ], |
||
| 103 | false, |
||
| 104 | ], |
||
| 105 | 'invalid-email-empty' => [ |
||
| 106 | [ |
||
| 107 | 'username' => 'foo', |
||
| 108 | 'email' => '', |
||
| 109 | 'user_group_ids' => [ |
||
| 110 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 111 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 112 | ], |
||
| 113 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 114 | 'password' => 'foo', |
||
| 115 | 'password_confirmed' => 'foo', |
||
| 116 | ], |
||
| 117 | false, |
||
| 118 | ], |
||
| 119 | 'invalid-email-missing' => [ |
||
| 120 | [ |
||
| 121 | 'username' => 'foo', |
||
| 122 | 'user_group_ids' => [ |
||
| 123 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 124 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 125 | ], |
||
| 126 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 127 | 'password' => 'foo', |
||
| 128 | 'password_confirmed' => 'foo', |
||
| 129 | ], |
||
| 130 | false, |
||
| 131 | ], |
||
| 132 | 'invalid-user-language-id-not-uuid' => [ |
||
| 133 | [ |
||
| 134 | 'username' => 'foo', |
||
| 135 | 'email' => '[email protected]', |
||
| 136 | 'user_group_ids' => [], |
||
| 137 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951', |
||
| 138 | 'password' => 'foo', |
||
| 139 | 'password_confirmed' => 'foo', |
||
| 140 | ], |
||
| 141 | false, |
||
| 142 | ], |
||
| 143 | 'invalid-user-language-id-empty' => [ |
||
| 144 | [ |
||
| 145 | 'username' => 'foo', |
||
| 146 | 'email' => '[email protected]', |
||
| 147 | 'user_group_ids' => [ |
||
| 148 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 149 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 150 | ], |
||
| 151 | 'user_language_id' => '', |
||
| 152 | 'password' => 'foo', |
||
| 153 | 'password_confirmed' => 'foo', |
||
| 154 | ], |
||
| 155 | false, |
||
| 156 | ], |
||
| 157 | 'invalid-user-language-id-missing' => [ |
||
| 158 | [ |
||
| 159 | 'username' => 'foo', |
||
| 160 | 'email' => '[email protected]', |
||
| 161 | 'user_group_ids' => [ |
||
| 162 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 163 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 164 | ], |
||
| 165 | 'password' => 'foo', |
||
| 166 | 'password_confirmed' => 'foo', |
||
| 167 | ], |
||
| 168 | false, |
||
| 169 | ], |
||
| 170 | 'invalid-passwords-dont-match' => [ |
||
| 171 | [ |
||
| 172 | 'username' => 'foo', |
||
| 173 | 'email' => '[email protected]', |
||
| 174 | 'user_group_ids' => [ |
||
| 175 | '5c032f90-bf10-4a77-81aa-b0b1254a8f66', |
||
| 176 | '96aaef56-0e11-4f1c-b407-a8b65ff8e647', |
||
| 177 | ], |
||
| 178 | 'user_language_id' => 'df99af41-82fd-4865-a3d1-6a2eebf0951c', |
||
| 179 | 'password' => 'foo', |
||
| 180 | 'password_confirmed' => 'bar', |
||
| 181 | ], |
||
| 182 | false, |
||
| 183 | ], |
||
| 250 |