| Conditions | 1 |
| Paths | 1 |
| Total Lines | 203 |
| Code Lines | 127 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 261 | public function nodeValuesProvider() { |
||
| 262 | $fieldValues = [ |
||
| 263 | 'body' => [ |
||
| 264 | 'value' => 'test', |
||
| 265 | 'summary' => 'test summary', |
||
| 266 | ], |
||
| 267 | 'field_text' => ['a', 'b', 'c'], |
||
| 268 | 'field_boolean' => [TRUE, FALSE], |
||
| 269 | 'field_link' => [ |
||
| 270 | [ |
||
| 271 | 'title' => 'Internal link', |
||
| 272 | 'uri' => 'internal:/node/1', |
||
| 273 | 'options' => ['attributes' => ['_target' => 'blank']], |
||
| 274 | ], |
||
| 275 | [ |
||
| 276 | 'title' => 'External link', |
||
| 277 | 'uri' => 'http://drupal.org', |
||
| 278 | 'options' => ['attributes' => ['_target' => 'blank']], |
||
| 279 | ], |
||
| 280 | ], |
||
| 281 | 'field_integer' => [10, -5], |
||
| 282 | 'field_float' => [3.14145, -8.8], |
||
| 283 | 'field_decimal' => [10.5, -17.22], |
||
| 284 | 'field_datetime' => ['2017-01-01', '1900-01-01'], |
||
| 285 | 'field_timestamp' => [0, 300], |
||
| 286 | 'field_email' => ['[email protected]'], |
||
| 287 | 'field_string' => ['test', '123'], |
||
| 288 | 'field_reference' => [ |
||
| 289 | ['target_id' => 1], |
||
| 290 | ], |
||
| 291 | 'field_file' => [ |
||
| 292 | [ |
||
| 293 | 'target_id' => 1, |
||
| 294 | 'display' => 0, |
||
| 295 | 'description' => 'description test 1', |
||
| 296 | ], |
||
| 297 | [ |
||
| 298 | 'target_id' => 2, |
||
| 299 | 'display' => 1, |
||
| 300 | 'description' => 'description test 2', |
||
| 301 | ], |
||
| 302 | ], |
||
| 303 | 'field_image' => [ |
||
| 304 | [ |
||
| 305 | 'target_id' => 1, |
||
| 306 | 'alt' => 'alt test 1', |
||
| 307 | 'title' => 'title test 1', |
||
| 308 | 'width' => 100, |
||
| 309 | 'height' => 50, |
||
| 310 | ], |
||
| 311 | [ |
||
| 312 | 'target_id' => 2, |
||
| 313 | 'alt' => 'alt test 2', |
||
| 314 | 'title' => 'title test 2', |
||
| 315 | 'width' => 200, |
||
| 316 | 'height' => 100, |
||
| 317 | ], |
||
| 318 | ], |
||
| 319 | ]; |
||
| 320 | |||
| 321 | $expected = [ |
||
| 322 | 'nid' => 1, |
||
| 323 | 'vid' => 1, |
||
| 324 | 'langcode' => [ |
||
| 325 | 'value' => 'en', |
||
| 326 | ], |
||
| 327 | 'type' => [ |
||
| 328 | 'targetId' => 'test', |
||
| 329 | ], |
||
| 330 | 'uid' => [ |
||
| 331 | 'targetId' => 0, |
||
| 332 | 'entity' => [ |
||
| 333 | 'name' => '', |
||
| 334 | ], |
||
| 335 | ], |
||
| 336 | 'title' => 'Test', |
||
| 337 | 'status' => TRUE, |
||
| 338 | 'promote' => TRUE, |
||
| 339 | 'sticky' => FALSE, |
||
| 340 | 'revisionTranslationAffected' => TRUE, |
||
| 341 | 'body' => [ |
||
| 342 | 'value' => 'test', |
||
| 343 | 'summary' => 'test summary', |
||
| 344 | 'summaryProcessed' => "<p>test summary</p>\n", |
||
| 345 | 'processed' => "<p>test</p>\n", |
||
| 346 | 'format' => NULL, |
||
| 347 | ], |
||
| 348 | 'fieldText' => [ |
||
| 349 | ['value' => 'a'], |
||
| 350 | ['value' => 'b'], |
||
| 351 | ['value' => 'c'], |
||
| 352 | ], |
||
| 353 | 'fieldBoolean' => [ |
||
| 354 | TRUE, |
||
| 355 | FALSE, |
||
| 356 | ], |
||
| 357 | 'fieldLink' => [ |
||
| 358 | [ |
||
| 359 | 'title' => 'Internal link', |
||
| 360 | 'uri' => 'internal:/node/1', |
||
| 361 | 'target' => 'blank', |
||
| 362 | 'url' => ['internal' => '/node/1'], |
||
| 363 | ], |
||
| 364 | [ |
||
| 365 | 'title' => 'External link', |
||
| 366 | 'uri' => 'http://drupal.org', |
||
| 367 | 'target' => 'blank', |
||
| 368 | 'url' => ['external' => 'http://drupal.org'], |
||
| 369 | ], |
||
| 370 | ], |
||
| 371 | 'fieldInteger' => [ |
||
| 372 | 10, |
||
| 373 | -5, |
||
| 374 | ], |
||
| 375 | 'fieldFloat' => [ |
||
| 376 | 3.14145, |
||
| 377 | -8.8, |
||
| 378 | ], |
||
| 379 | 'fieldDecimal' => [ |
||
| 380 | 10.5, |
||
| 381 | -17.22, |
||
| 382 | ], |
||
| 383 | 'fieldDatetime' => [ |
||
| 384 | ['value' => '2017-01-01'], |
||
| 385 | ['value' => '1900-01-01'], |
||
| 386 | ], |
||
| 387 | 'fieldTimestamp' => [ |
||
| 388 | 0, |
||
| 389 | 300, |
||
| 390 | ], |
||
| 391 | 'fieldEmail' => ['[email protected]'], |
||
| 392 | 'fieldString' => [ |
||
| 393 | 'test', |
||
| 394 | '123', |
||
| 395 | ], |
||
| 396 | 'fieldReference' => [ |
||
| 397 | [ |
||
| 398 | 'targetId' => 1, |
||
| 399 | 'entity' => [ |
||
| 400 | 'title' => 'Test', |
||
| 401 | 'fieldReference' => [ |
||
| 402 | [ |
||
| 403 | 'targetId' => 1, |
||
| 404 | 'entity' => [ |
||
| 405 | 'title' => 'Test', |
||
| 406 | ], |
||
| 407 | ], |
||
| 408 | ], |
||
| 409 | ], |
||
| 410 | ], |
||
| 411 | ], |
||
| 412 | 'fieldFile' => [ |
||
| 413 | [ |
||
| 414 | 'targetId' => 1, |
||
| 415 | 'display' => FALSE, |
||
| 416 | 'description' => 'description test 1', |
||
| 417 | 'entity' => [ |
||
| 418 | // 'uri' => [ |
||
| 419 | // 'value' => 'public://example.txt', |
||
| 420 | // ], |
||
| 421 | ], |
||
| 422 | ], |
||
| 423 | [ |
||
| 424 | 'targetId' => 2, |
||
| 425 | 'display' => TRUE, |
||
| 426 | 'description' => 'description test 2', |
||
| 427 | 'entity' => [ |
||
| 428 | // 'uri' => [ |
||
| 429 | // 'value' => 'public://example.png', |
||
| 430 | // ], |
||
| 431 | ], |
||
| 432 | ], |
||
| 433 | ], |
||
| 434 | 'fieldImage' => [ |
||
| 435 | [ |
||
| 436 | 'targetId' => 1, |
||
| 437 | 'alt' => 'alt test 1', |
||
| 438 | 'title' => 'title test 1', |
||
| 439 | 'width' => 100, |
||
| 440 | 'height' => 50, |
||
| 441 | 'entity' => [ |
||
| 442 | // 'uri' => [ |
||
| 443 | // 'value' => 'public://example.txt', |
||
| 444 | // ], |
||
| 445 | ], |
||
| 446 | ], |
||
| 447 | [ |
||
| 448 | 'targetId' => 2, |
||
| 449 | 'alt' => 'alt test 2', |
||
| 450 | 'title' => 'title test 2', |
||
| 451 | 'width' => 200, |
||
| 452 | 'height' => 100, |
||
| 453 | 'entity' => [ |
||
| 454 | // 'uri' => [ |
||
| 455 | // 'value' => 'public://example.png', |
||
| 456 | // ], |
||
| 457 | ], |
||
| 458 | ], |
||
| 459 | ], |
||
| 460 | ]; |
||
| 461 | |||
| 462 | return [ |
||
| 463 | [$fieldValues, $expected], |
||
| 464 | ]; |
||
| 468 |
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