| Conditions | 1 |
| Paths | 1 |
| Total Lines | 209 |
| Code Lines | 97 |
| 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 |
||
| 393 | public function outputData() |
||
| 394 | { |
||
| 395 | return [ |
||
| 396 | [ // verbose with single valid run |
||
| 397 | OutputInterface::VERBOSITY_VERBOSE, |
||
| 398 | false, |
||
| 399 | false, |
||
| 400 | [true], |
||
| 401 | [ |
||
| 402 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) %'], |
||
| 403 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%'], |
||
| 404 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%'], |
||
| 405 | ], |
||
| 406 | ], |
||
| 407 | [ // normal verbosity only writes a single line |
||
| 408 | OutputInterface::VERBOSITY_NORMAL, |
||
| 409 | false, |
||
| 410 | false, |
||
| 411 | [true], |
||
| 412 | [ |
||
| 413 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%'], |
||
| 414 | ], |
||
| 415 | ], |
||
| 416 | [ |
||
| 417 | OutputInterface::VERBOSITY_NORMAL, |
||
| 418 | false, |
||
| 419 | false, |
||
| 420 | [true, true], |
||
| 421 | [ |
||
| 422 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%'], |
||
| 423 | ['%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%'], |
||
| 424 | ], |
||
| 425 | ], |
||
| 426 | [ // multiple runs with verbosity will update each item one at a time |
||
| 427 | OutputInterface::VERBOSITY_VERBOSE, |
||
| 428 | false, |
||
| 429 | false, |
||
| 430 | [true, true], |
||
| 431 | [ |
||
| 432 | [ |
||
| 433 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 434 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 435 | ], |
||
| 436 | [ |
||
| 437 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 438 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 439 | ], |
||
| 440 | [ |
||
| 441 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 442 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 443 | ], |
||
| 444 | [ |
||
| 445 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 446 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 447 | ], |
||
| 448 | [ |
||
| 449 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 450 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 451 | ], |
||
| 452 | ], |
||
| 453 | ], |
||
| 454 | [ // errors will display an error |
||
| 455 | OutputInterface::VERBOSITY_VERBOSE, |
||
| 456 | false, |
||
| 457 | false, |
||
| 458 | [false], |
||
| 459 | [ |
||
| 460 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) %'], |
||
| 461 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%'], |
||
| 462 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <error>x</error>%'], |
||
| 463 | [ |
||
| 464 | <<<DOC |
||
| 465 | %The command "test" failed. |
||
| 466 | |||
| 467 | Exit Code: 1\(failed\) |
||
| 468 | |||
| 469 | Working directory: /tmp |
||
| 470 | |||
| 471 | Output: |
||
| 472 | ================ |
||
| 473 | some text |
||
| 474 | |||
| 475 | Error Output: |
||
| 476 | ================ |
||
| 477 | some error text% |
||
| 478 | DOC |
||
| 479 | , |
||
| 480 | ], |
||
| 481 | ], |
||
| 482 | ], |
||
| 483 | [ // errors will display an error |
||
| 484 | OutputInterface::VERBOSITY_NORMAL, |
||
| 485 | false, |
||
| 486 | false, |
||
| 487 | [false], |
||
| 488 | [ |
||
| 489 | ['%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <error>x</error>%'], |
||
| 490 | [ |
||
| 491 | <<<DOC |
||
| 492 | %The command "test" failed. |
||
| 493 | |||
| 494 | Exit Code: 1\(failed\) |
||
| 495 | |||
| 496 | Working directory: /tmp |
||
| 497 | |||
| 498 | Output: |
||
| 499 | ================ |
||
| 500 | some text |
||
| 501 | |||
| 502 | Error Output: |
||
| 503 | ================ |
||
| 504 | some error text% |
||
| 505 | DOC |
||
| 506 | , |
||
| 507 | ], |
||
| 508 | ], |
||
| 509 | ], |
||
| 510 | [ // multiple runs with verbosity will update each item one at a time |
||
| 511 | OutputInterface::VERBOSITY_VERBOSE, |
||
| 512 | false, |
||
| 513 | false, |
||
| 514 | [true, false], |
||
| 515 | [ |
||
| 516 | [ |
||
| 517 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 518 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 519 | ], |
||
| 520 | [ |
||
| 521 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 522 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 523 | ], |
||
| 524 | [ |
||
| 525 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 526 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 527 | ], |
||
| 528 | [ |
||
| 529 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 530 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 531 | ], |
||
| 532 | [ |
||
| 533 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 534 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) <error>x</error>%', |
||
| 535 | ], |
||
| 536 | [ |
||
| 537 | <<<DOC |
||
| 538 | %The command "test" failed. |
||
| 539 | |||
| 540 | Exit Code: 1\(failed\) |
||
| 541 | |||
| 542 | Working directory: /tmp |
||
| 543 | |||
| 544 | Output: |
||
| 545 | ================ |
||
| 546 | some text |
||
| 547 | |||
| 548 | Error Output: |
||
| 549 | ================ |
||
| 550 | some error text% |
||
| 551 | DOC |
||
| 552 | , |
||
| 553 | ], |
||
| 554 | ], |
||
| 555 | ], |
||
| 556 | [ // include output |
||
| 557 | OutputInterface::VERBOSITY_VERBOSE, |
||
| 558 | true, |
||
| 559 | false, |
||
| 560 | [true], |
||
| 561 | [ |
||
| 562 | ['%(*UTF8)<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) %'], |
||
| 563 | ['%(*UTF8)<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏] some text%'], |
||
| 564 | ['%(*UTF8)<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info> some text%'], |
||
| 565 | ], |
||
| 566 | ], |
||
| 567 | [ // include a summary |
||
| 568 | OutputInterface::VERBOSITY_VERBOSE, |
||
| 569 | false, |
||
| 570 | true, |
||
| 571 | [true, true], |
||
| 572 | [ |
||
| 573 | [ |
||
| 574 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 575 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 576 | '%^waiting...$%', |
||
| 577 | ], |
||
| 578 | [ |
||
| 579 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 580 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) %', |
||
| 581 | '%<comment>Total</comment>: 2, <comment>Running</comment>: 2, <comment>Waiting</comment>: 0%', |
||
| 582 | ], |
||
| 583 | [ |
||
| 584 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 585 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 586 | '%<comment>Total</comment>: 2, <comment>Running</comment>: 2, <comment>Waiting</comment>: 0%', |
||
| 587 | ], |
||
| 588 | [ |
||
| 589 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 590 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) [⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]%', |
||
| 591 | '%<comment>Total</comment>: 2, <comment>Running</comment>: 2, <comment>Waiting</comment>: 0%', |
||
| 592 | ], |
||
| 593 | [ |
||
| 594 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 595 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 596 | '%<comment>Total</comment>: 2, <comment>Running</comment>: 1, <comment>Waiting</comment>: 0%', |
||
| 597 | ], |
||
| 598 | [ |
||
| 599 | '%<info>key</info>: value <info>run</info>: 0 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 600 | '%<info>key</info>: value <info>run</info>: 1 \(<comment>[ 0-9\.s]+</comment>\) <info>✓</info>%', |
||
| 601 | '%^$%', |
||
| 602 | ], |
||
| 608 |