| Conditions | 1 |
| Paths | 1 |
| Total Lines | 209 |
| Code Lines | 136 |
| 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 |
||
| 119 | protected function requestPostCustomerFailsValidationDataProvider(): array |
||
| 120 | { |
||
| 121 | return [ |
||
| 122 | [ |
||
| 123 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 124 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456', |
||
| 125 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!23456', |
||
| 126 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => false, |
||
| 127 | ]))->build(), |
||
| 128 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 129 | 'errors' => [ |
||
| 130 | [ |
||
| 131 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 132 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 133 | RestErrorMessageTransfer::DETAIL => 'acceptedTerms => This value should be true.', |
||
| 134 | ], |
||
| 135 | ], |
||
| 136 | ], |
||
| 137 | [ |
||
| 138 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 139 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456', |
||
| 140 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!23456', |
||
| 141 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 142 | RestCustomersAttributesTransfer::SALUTATION => 'xyz', |
||
| 143 | ]))->build(), |
||
| 144 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 145 | 'errors' => [ |
||
| 146 | [ |
||
| 147 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 148 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 149 | RestErrorMessageTransfer::DETAIL => 'salutation => The value you selected is not a valid choice.', |
||
| 150 | ], |
||
| 151 | ], |
||
| 152 | ], |
||
| 153 | [ |
||
| 154 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 155 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456', |
||
| 156 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!23456', |
||
| 157 | ]))->build(), |
||
| 158 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 159 | 'errors' => [ |
||
| 160 | [ |
||
| 161 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_NOT_ACCEPTED_TERMS, |
||
| 162 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 163 | RestErrorMessageTransfer::DETAIL => CustomersRestApiConfig::RESPONSE_DETAILS_NOT_ACCEPTED_TERMS, |
||
| 164 | ], |
||
| 165 | ], |
||
| 166 | ], |
||
| 167 | [ |
||
| 168 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 169 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456', |
||
| 170 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!234564', |
||
| 171 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 172 | ]))->build(), |
||
| 173 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 174 | 'errors' => [ |
||
| 175 | [ |
||
| 176 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_PASSWORDS_DONT_MATCH, |
||
| 177 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 178 | RestErrorMessageTransfer::DETAIL => sprintf( |
||
| 179 | CustomersRestApiConfig::RESPONSE_DETAILS_PASSWORDS_DONT_MATCH, |
||
| 180 | RestCustomersAttributesTransfer::PASSWORD, |
||
| 181 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD, |
||
| 182 | ), |
||
| 183 | ], |
||
| 184 | ], |
||
| 185 | ], |
||
| 186 | [ |
||
| 187 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 188 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!23456', |
||
| 189 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 190 | ]))->build(), |
||
| 191 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 192 | 'errors' => [ |
||
| 193 | [ |
||
| 194 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 195 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 196 | RestErrorMessageTransfer::DETAIL => 'password => This value should not be blank.', |
||
| 197 | ], |
||
| 198 | ], |
||
| 199 | ], |
||
| 200 | [ |
||
| 201 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 202 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456', |
||
| 203 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 204 | ]))->build(), |
||
| 205 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 206 | 'errors' => [ |
||
| 207 | [ |
||
| 208 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 209 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 210 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value should not be blank.', |
||
| 211 | ], |
||
| 212 | ], |
||
| 213 | ], |
||
| 214 | [ |
||
| 215 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 216 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456pqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuioppqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwert', |
||
| 217 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!23456pqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuioppqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwert', |
||
| 218 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 219 | ]))->build(), |
||
| 220 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 221 | 'errors' => [ |
||
| 222 | [ |
||
| 223 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 224 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 225 | RestErrorMessageTransfer::DETAIL => 'password => This value is too long. It should have 128 characters or less.', |
||
| 226 | ], |
||
| 227 | [ |
||
| 228 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 229 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 230 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value is too long. It should have 128 characters or less.', |
||
| 231 | ], |
||
| 232 | ], |
||
| 233 | ], |
||
| 234 | [ |
||
| 235 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 236 | RestCustomersAttributesTransfer::PASSWORD => 'qwe', |
||
| 237 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'qwe', |
||
| 238 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 239 | ]))->build(), |
||
| 240 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 241 | 'errors' => [ |
||
| 242 | [ |
||
| 243 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 244 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 245 | RestErrorMessageTransfer::DETAIL => 'password => This value is too short. It should have 12 characters or more.', |
||
| 246 | ], |
||
| 247 | [ |
||
| 248 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 249 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 250 | RestErrorMessageTransfer::DETAIL => 'password => Your password must include at least one uppercase letter, one lowercase letter, one number, and one special character from the following list: !@#$%^&*()_-+=[]{}|;:<>.,/?\~. Non-Latin and other special characters are not allowed.', |
||
| 251 | ], |
||
| 252 | [ |
||
| 253 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 254 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 255 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value is too short. It should have 12 characters or more.', |
||
| 256 | ], |
||
| 257 | ], |
||
| 258 | ], |
||
| 259 | [ |
||
| 260 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 261 | RestCustomersAttributesTransfer::PASSWORD => 'qwertyuI1!eee', |
||
| 262 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'qwertyuI1!eee', |
||
| 263 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 264 | ]))->build(), |
||
| 265 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 266 | 'errors' => [ |
||
| 267 | [ |
||
| 268 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_CUSTOMER_PASSWORD_SEQUENCE_NOT_ALLOWED, |
||
| 269 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 270 | RestErrorMessageTransfer::DETAIL => CustomersRestApiConfig::RESPONSE_MESSAGE_CUSTOMER_PASSWORD_SEQUENCE_NOT_ALLOWED, |
||
| 271 | ], |
||
| 272 | ], |
||
| 273 | ], |
||
| 274 | [ |
||
| 275 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 276 | RestCustomersAttributesTransfer::PASSWORD => 'Change!23456', |
||
| 277 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'Change!23456', |
||
| 278 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 279 | RestCustomersAttributesTransfer::GENDER => 'xyz', |
||
| 280 | ]))->build(), |
||
| 281 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 282 | 'errors' => [ |
||
| 283 | [ |
||
| 284 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 285 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 286 | RestErrorMessageTransfer::DETAIL => 'gender => The value you selected is not a valid choice.', |
||
| 287 | ], |
||
| 288 | ], |
||
| 289 | ], |
||
| 290 | [ |
||
| 291 | 'attributes' => new RestCustomersAttributesTransfer(), |
||
| 292 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 293 | 'errors' => [ |
||
| 294 | [ |
||
| 295 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 296 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 297 | RestErrorMessageTransfer::DETAIL => 'email => This value should not be blank.', |
||
| 298 | ], |
||
| 299 | [ |
||
| 300 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 301 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 302 | RestErrorMessageTransfer::DETAIL => 'gender => This value should not be blank.', |
||
| 303 | ], |
||
| 304 | [ |
||
| 305 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 306 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 307 | RestErrorMessageTransfer::DETAIL => 'salutation => This value should not be blank.', |
||
| 308 | ], |
||
| 309 | [ |
||
| 310 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 311 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 312 | RestErrorMessageTransfer::DETAIL => 'firstName => This value should not be blank.', |
||
| 313 | ], |
||
| 314 | [ |
||
| 315 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 316 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 317 | RestErrorMessageTransfer::DETAIL => 'lastName => This value should not be blank.', |
||
| 318 | ], |
||
| 319 | [ |
||
| 320 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 321 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 322 | RestErrorMessageTransfer::DETAIL => 'password => This value should not be blank.', |
||
| 323 | ], |
||
| 324 | [ |
||
| 325 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 326 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 327 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value should not be blank.', |
||
| 328 | ], |
||
| 334 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths