| @@ 665-716 (lines=52) @@ | ||
| 662 | /** |
|
| 663 | * @param int $pos |
|
| 664 | */ |
|
| 665 | private function displayResult(int $pos = 0) { |
|
| 666 | $total = sizeof($this->results); |
|
| 667 | ||
| 668 | if ($total === 0) { |
|
| 669 | $this->runner->setInfoArray( |
|
| 670 | [ |
|
| 671 | 'resultCurrent' => 0, |
|
| 672 | 'resultTotal' => 0, |
|
| 673 | ] |
|
| 674 | ); |
|
| 675 | ||
| 676 | return; |
|
| 677 | } |
|
| 678 | ||
| 679 | try { |
|
| 680 | $current = key($this->results) + 1; |
|
| 681 | $result = $this->getNavigationResult($pos, ($current === 1), ($current === $total)); |
|
| 682 | $current = key($this->results) + 1; |
|
| 683 | } catch (OutOfBoundsException $e) { |
|
| 684 | return; |
|
| 685 | } |
|
| 686 | ||
| 687 | /** @var ModelIndex $index */ |
|
| 688 | $index = $result['index']; |
|
| 689 | $resultIndex = ''; |
|
| 690 | if ($index !== null) { |
|
| 691 | $resultIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 692 | } |
|
| 693 | ||
| 694 | ||
| 695 | $width = $this->terminal->getWidth() - 13; |
|
| 696 | $message = $this->get('message', $result, ''); |
|
| 697 | $msg1 = (string)substr($message, 0, $width); |
|
| 698 | $msg2 = (string)substr($message, $width, $width + 10); |
|
| 699 | $msg3 = (string)substr($message, $width + $width + 10, $width + 10); |
|
| 700 | ||
| 701 | $status = $this->get('status', $result, ''); |
|
| 702 | $type = $this->getInt('type', $result, 0); |
|
| 703 | ||
| 704 | $this->runner->setInfoArray( |
|
| 705 | [ |
|
| 706 | 'resultCurrent' => $current, |
|
| 707 | 'resultTotal' => $total, |
|
| 708 | 'resultMessageA' => trim($msg1), |
|
| 709 | 'resultMessageB' => trim($msg2), |
|
| 710 | 'resultMessageC' => trim($msg3), |
|
| 711 | 'resultStatus' => $status, |
|
| 712 | 'resultIndex' => $resultIndex |
|
| 713 | ] |
|
| 714 | ); |
|
| 715 | $this->runner->setInfoColored('resultStatus', $type); |
|
| 716 | } |
|
| 717 | ||
| 718 | ||
| 719 | /** |
|
| @@ 544-597 (lines=54) @@ | ||
| 541 | /** |
|
| 542 | * @param int $pos |
|
| 543 | */ |
|
| 544 | private function displayResult(int $pos = 0) { |
|
| 545 | $total = sizeof($this->results); |
|
| 546 | ||
| 547 | if ($total === 0) { |
|
| 548 | $this->runner->setInfoArray( |
|
| 549 | [ |
|
| 550 | 'resultCurrent' => 0, |
|
| 551 | 'resultTotal' => 0, |
|
| 552 | ] |
|
| 553 | ); |
|
| 554 | ||
| 555 | return; |
|
| 556 | } |
|
| 557 | ||
| 558 | try { |
|
| 559 | $current = key($this->results) + 1; |
|
| 560 | $result = $this->getNavigationResult($pos, ($current === 1), ($current === $total)); |
|
| 561 | $current = key($this->results) + 1; |
|
| 562 | } catch (OutOfBoundsException $e) { |
|
| 563 | return; |
|
| 564 | } |
|
| 565 | ||
| 566 | /** @var ModelIndex $index */ |
|
| 567 | $index = $result['index']; |
|
| 568 | $resultIndex = ''; |
|
| 569 | if ($index !== null) { |
|
| 570 | $resultIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 571 | } |
|
| 572 | ||
| 573 | ||
| 574 | $width = $this->terminal->getWidth() - 13; |
|
| 575 | $message = $this->get('message', $result, ''); |
|
| 576 | $msg1 = (string)substr($message, 0, $width); |
|
| 577 | $msg2 = (string)substr($message, $width, $width + 10); |
|
| 578 | $msg3 = (string)substr($message, $width + $width + 10, $width + 10); |
|
| 579 | ||
| 580 | ||
| 581 | $status = $this->get('status', $result, ''); |
|
| 582 | $type = $this->getInt('type', $result, 0); |
|
| 583 | ||
| 584 | ||
| 585 | $this->runner->setInfoArray( |
|
| 586 | [ |
|
| 587 | 'resultCurrent' => $current, |
|
| 588 | 'resultTotal' => $total, |
|
| 589 | 'resultMessageA' => trim($msg1), |
|
| 590 | 'resultMessageB' => trim($msg2), |
|
| 591 | 'resultMessageC' => trim($msg3), |
|
| 592 | 'resultStatus' => $status, |
|
| 593 | 'resultIndex' => $resultIndex |
|
| 594 | ] |
|
| 595 | ); |
|
| 596 | $this->runner->setInfoColored('resultStatus', $type); |
|
| 597 | } |
|
| 598 | ||
| 599 | /** |
|
| 600 | * @param int $pos |
|