| Conditions | 1 |
| Paths | 1 |
| Total Lines | 219 |
| Code Lines | 143 |
| 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 |
||
| 132 | protected function requestPostCustomerFailsValidationDataProvider(): array |
||
| 133 | { |
||
| 134 | return [ |
||
| 135 | [ |
||
| 136 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 137 | RestCustomersAttributesTransfer::PASSWORD => 'change123', |
||
| 138 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'change123', |
||
| 139 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => false, |
||
| 140 | ]))->build(), |
||
| 141 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 142 | 'errors' => [ |
||
| 143 | [ |
||
| 144 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 145 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 146 | RestErrorMessageTransfer::DETAIL => 'acceptedTerms => This value should be true.', |
||
| 147 | ], |
||
| 148 | ], |
||
| 149 | ], |
||
| 150 | [ |
||
| 151 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 152 | RestCustomersAttributesTransfer::PASSWORD => 'change123', |
||
| 153 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'change123', |
||
| 154 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 155 | RestCustomersAttributesTransfer::SALUTATION => 'xyz', |
||
| 156 | ]))->build(), |
||
| 157 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 158 | 'errors' => [ |
||
| 159 | [ |
||
| 160 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 161 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 162 | RestErrorMessageTransfer::DETAIL => 'salutation => The value you selected is not a valid choice.', |
||
| 163 | ], |
||
| 164 | ], |
||
| 165 | ], |
||
| 166 | [ |
||
| 167 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 168 | RestCustomersAttributesTransfer::PASSWORD => 'change123', |
||
| 169 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'change123', |
||
| 170 | ]))->build(), |
||
| 171 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 172 | 'errors' => [ |
||
| 173 | [ |
||
| 174 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_NOT_ACCEPTED_TERMS, |
||
| 175 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 176 | RestErrorMessageTransfer::DETAIL => CustomersRestApiConfig::RESPONSE_DETAILS_NOT_ACCEPTED_TERMS, |
||
| 177 | ], |
||
| 178 | ], |
||
| 179 | ], |
||
| 180 | [ |
||
| 181 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 182 | RestCustomersAttributesTransfer::PASSWORD => 'change123', |
||
| 183 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'change1234', |
||
| 184 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 185 | ]))->build(), |
||
| 186 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 187 | 'errors' => [ |
||
| 188 | [ |
||
| 189 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_PASSWORDS_DONT_MATCH, |
||
| 190 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 191 | RestErrorMessageTransfer::DETAIL => sprintf( |
||
| 192 | CustomersRestApiConfig::RESPONSE_DETAILS_PASSWORDS_DONT_MATCH, |
||
| 193 | RestCustomersAttributesTransfer::PASSWORD, |
||
| 194 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD, |
||
| 195 | ), |
||
| 196 | ], |
||
| 197 | ], |
||
| 198 | ], |
||
| 199 | [ |
||
| 200 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 201 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'change123', |
||
| 202 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 203 | ]))->build(), |
||
| 204 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 205 | 'errors' => [ |
||
| 206 | [ |
||
| 207 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 208 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 209 | RestErrorMessageTransfer::DETAIL => 'password => This value should not be blank.', |
||
| 210 | ], |
||
| 211 | ], |
||
| 212 | ], |
||
| 213 | [ |
||
| 214 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 215 | RestCustomersAttributesTransfer::PASSWORD => 'change123', |
||
| 216 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 217 | ]))->build(), |
||
| 218 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 219 | 'errors' => [ |
||
| 220 | [ |
||
| 221 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 222 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 223 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value should not be blank.', |
||
| 224 | ], |
||
| 225 | ], |
||
| 226 | ], |
||
| 227 | [ |
||
| 228 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 229 | RestCustomersAttributesTransfer::PASSWORD => 'qwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiop', |
||
| 230 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'qwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiop', |
||
| 231 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 232 | ]))->build(), |
||
| 233 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 234 | 'errors' => [ |
||
| 235 | [ |
||
| 236 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 237 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 238 | RestErrorMessageTransfer::DETAIL => 'password => This value is too long. It should have 64 characters or less.', |
||
| 239 | ], |
||
| 240 | [ |
||
| 241 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 242 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 243 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value is too long. It should have 64 characters or less.', |
||
| 244 | ], |
||
| 245 | ], |
||
| 246 | ], |
||
| 247 | [ |
||
| 248 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 249 | RestCustomersAttributesTransfer::PASSWORD => 'qwe', |
||
| 250 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'qwe', |
||
| 251 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 252 | ]))->build(), |
||
| 253 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 254 | 'errors' => [ |
||
| 255 | [ |
||
| 256 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 257 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 258 | RestErrorMessageTransfer::DETAIL => 'password => This value is too short. It should have 8 characters or more.', |
||
| 259 | ], |
||
| 260 | [ |
||
| 261 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 262 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 263 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value is too short. It should have 8 characters or more.', |
||
| 264 | ], |
||
| 265 | ], |
||
| 266 | ], |
||
| 267 | [ |
||
| 268 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 269 | RestCustomersAttributesTransfer::PASSWORD => 'qwertyui', |
||
| 270 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'qwertyui', |
||
| 271 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 272 | ]))->build(), |
||
| 273 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 274 | 'errors' => [ |
||
| 275 | [ |
||
| 276 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_CUSTOMER_PASSWORD_INVALID_CHARACTER_SET, |
||
| 277 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 278 | RestErrorMessageTransfer::DETAIL => CustomersRestApiConfig::RESPONSE_MESSAGE_CUSTOMER_PASSWORD_INVALID_CHARACTER_SET, |
||
| 279 | ], |
||
| 280 | ], |
||
| 281 | ], |
||
| 282 | [ |
||
| 283 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 284 | RestCustomersAttributesTransfer::PASSWORD => 'qwertyuI1!eee', |
||
| 285 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'qwertyuI1!eee', |
||
| 286 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 287 | ]))->build(), |
||
| 288 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 289 | 'errors' => [ |
||
| 290 | [ |
||
| 291 | RestErrorMessageTransfer::CODE => CustomersRestApiConfig::RESPONSE_CODE_CUSTOMER_PASSWORD_SEQUENCE_NOT_ALLOWED, |
||
| 292 | RestErrorMessageTransfer::STATUS => Response::HTTP_BAD_REQUEST, |
||
| 293 | RestErrorMessageTransfer::DETAIL => CustomersRestApiConfig::RESPONSE_MESSAGE_CUSTOMER_PASSWORD_SEQUENCE_NOT_ALLOWED, |
||
| 294 | ], |
||
| 295 | ], |
||
| 296 | ], |
||
| 297 | [ |
||
| 298 | 'attributes' => (new RestCustomersAttributesBuilder([ |
||
| 299 | RestCustomersAttributesTransfer::PASSWORD => 'change123', |
||
| 300 | RestCustomersAttributesTransfer::CONFIRM_PASSWORD => 'change123', |
||
| 301 | RestCustomersAttributesTransfer::ACCEPTED_TERMS => true, |
||
| 302 | RestCustomersAttributesTransfer::GENDER => 'xyz', |
||
| 303 | ]))->build(), |
||
| 304 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 305 | 'errors' => [ |
||
| 306 | [ |
||
| 307 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 308 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 309 | RestErrorMessageTransfer::DETAIL => 'gender => The value you selected is not a valid choice.', |
||
| 310 | ], |
||
| 311 | ], |
||
| 312 | ], |
||
| 313 | [ |
||
| 314 | 'attributes' => new RestCustomersAttributesTransfer(), |
||
| 315 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 316 | 'errors' => [ |
||
| 317 | [ |
||
| 318 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 319 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 320 | RestErrorMessageTransfer::DETAIL => 'email => This value should not be blank.', |
||
| 321 | ], |
||
| 322 | [ |
||
| 323 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 324 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 325 | RestErrorMessageTransfer::DETAIL => 'gender => This value should not be blank.', |
||
| 326 | ], |
||
| 327 | [ |
||
| 328 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 329 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 330 | RestErrorMessageTransfer::DETAIL => 'salutation => This value should not be blank.', |
||
| 331 | ], |
||
| 332 | [ |
||
| 333 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 334 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 335 | RestErrorMessageTransfer::DETAIL => 'firstName => This value should not be blank.', |
||
| 336 | ], |
||
| 337 | [ |
||
| 338 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 339 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 340 | RestErrorMessageTransfer::DETAIL => 'lastName => This value should not be blank.', |
||
| 341 | ], |
||
| 342 | [ |
||
| 343 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 344 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 345 | RestErrorMessageTransfer::DETAIL => 'password => This value should not be blank.', |
||
| 346 | ], |
||
| 347 | [ |
||
| 348 | RestErrorMessageTransfer::CODE => RestRequestValidatorConfig::RESPONSE_CODE_REQUEST_INVALID, |
||
| 349 | RestErrorMessageTransfer::STATUS => Response::HTTP_UNPROCESSABLE_ENTITY, |
||
| 350 | RestErrorMessageTransfer::DETAIL => 'confirmPassword => This value should not be blank.', |
||
| 351 | ], |
||
| 357 |
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