| @@ 661-712 (lines=52) @@ | ||
| 658 | /** |
|
| 659 | * @param int $pos |
|
| 660 | */ |
|
| 661 | private function displayResult(int $pos = 0) { |
|
| 662 | $total = sizeof($this->results); |
|
| 663 | ||
| 664 | if ($total === 0) { |
|
| 665 | $this->runner->setInfoArray( |
|
| 666 | [ |
|
| 667 | 'resultCurrent' => 0, |
|
| 668 | 'resultTotal' => 0, |
|
| 669 | ] |
|
| 670 | ); |
|
| 671 | ||
| 672 | return; |
|
| 673 | } |
|
| 674 | ||
| 675 | try { |
|
| 676 | $current = key($this->results) + 1; |
|
| 677 | $result = $this->getNavigationResult($pos, ($current === 1), ($current === $total)); |
|
| 678 | $current = key($this->results) + 1; |
|
| 679 | } catch (OutOfBoundsException $e) { |
|
| 680 | return; |
|
| 681 | } |
|
| 682 | ||
| 683 | /** @var ModelIndex $index */ |
|
| 684 | $index = $result['index']; |
|
| 685 | $resultIndex = ''; |
|
| 686 | if ($index !== null) { |
|
| 687 | $resultIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 688 | } |
|
| 689 | ||
| 690 | ||
| 691 | $width = $this->terminal->getWidth() - 13; |
|
| 692 | $message = $this->get('message', $result, ''); |
|
| 693 | $msg1 = (string)substr($message, 0, $width); |
|
| 694 | $msg2 = (string)substr($message, $width, $width + 10); |
|
| 695 | $msg3 = (string)substr($message, $width + $width + 10, $width + 10); |
|
| 696 | ||
| 697 | $status = $this->get('status', $result, ''); |
|
| 698 | $type = $this->getInt('type', $result, 0); |
|
| 699 | ||
| 700 | $this->runner->setInfoArray( |
|
| 701 | [ |
|
| 702 | 'resultCurrent' => $current, |
|
| 703 | 'resultTotal' => $total, |
|
| 704 | 'resultMessageA' => trim($msg1), |
|
| 705 | 'resultMessageB' => trim($msg2), |
|
| 706 | 'resultMessageC' => trim($msg3), |
|
| 707 | 'resultStatus' => $status, |
|
| 708 | 'resultIndex' => $resultIndex |
|
| 709 | ] |
|
| 710 | ); |
|
| 711 | $this->runner->setInfoColored('resultStatus', $type); |
|
| 712 | } |
|
| 713 | ||
| 714 | ||
| 715 | /** |
|
| @@ 523-576 (lines=54) @@ | ||
| 520 | /** |
|
| 521 | * @param int $pos |
|
| 522 | */ |
|
| 523 | private function displayResult(int $pos = 0) { |
|
| 524 | $total = sizeof($this->results); |
|
| 525 | ||
| 526 | if ($total === 0) { |
|
| 527 | $this->runner->setInfoArray( |
|
| 528 | [ |
|
| 529 | 'resultCurrent' => 0, |
|
| 530 | 'resultTotal' => 0, |
|
| 531 | ] |
|
| 532 | ); |
|
| 533 | ||
| 534 | return; |
|
| 535 | } |
|
| 536 | ||
| 537 | try { |
|
| 538 | $current = key($this->results) + 1; |
|
| 539 | $result = $this->getNavigationResult($pos, ($current === 1), ($current === $total)); |
|
| 540 | $current = key($this->results) + 1; |
|
| 541 | } catch (OutOfBoundsException $e) { |
|
| 542 | return; |
|
| 543 | } |
|
| 544 | ||
| 545 | /** @var ModelIndex $index */ |
|
| 546 | $index = $result['index']; |
|
| 547 | $resultIndex = ''; |
|
| 548 | if ($index !== null) { |
|
| 549 | $resultIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 550 | } |
|
| 551 | ||
| 552 | ||
| 553 | $width = $this->terminal->getWidth() - 13; |
|
| 554 | $message = $this->get('message', $result, ''); |
|
| 555 | $msg1 = (string)substr($message, 0, $width); |
|
| 556 | $msg2 = (string)substr($message, $width, $width + 10); |
|
| 557 | $msg3 = (string)substr($message, $width + $width + 10, $width + 10); |
|
| 558 | ||
| 559 | ||
| 560 | $status = $this->get('status', $result, ''); |
|
| 561 | $type = $this->getInt('type', $result, 0); |
|
| 562 | ||
| 563 | ||
| 564 | $this->runner->setInfoArray( |
|
| 565 | [ |
|
| 566 | 'resultCurrent' => $current, |
|
| 567 | 'resultTotal' => $total, |
|
| 568 | 'resultMessageA' => trim($msg1), |
|
| 569 | 'resultMessageB' => trim($msg2), |
|
| 570 | 'resultMessageC' => trim($msg3), |
|
| 571 | 'resultStatus' => $status, |
|
| 572 | 'resultIndex' => $resultIndex |
|
| 573 | ] |
|
| 574 | ); |
|
| 575 | $this->runner->setInfoColored('resultStatus', $type); |
|
| 576 | } |
|
| 577 | ||
| 578 | /** |
|
| 579 | * @param int $pos |
|