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