| @@ 621-673 (lines=53) @@ | ||
| 618 | /** |
|
| 619 | * @param int $pos |
|
| 620 | */ |
|
| 621 | private function displayResult($pos = 0) { |
|
| 622 | $total = sizeof($this->results); |
|
| 623 | ||
| 624 | if ($total === 0) { |
|
| 625 | $this->runner->setInfoArray( |
|
| 626 | [ |
|
| 627 | 'resultCurrent' => 0, |
|
| 628 | 'resultTotal' => 0, |
|
| 629 | ] |
|
| 630 | ); |
|
| 631 | ||
| 632 | return; |
|
| 633 | } |
|
| 634 | ||
| 635 | $current = key($this->results) + 1; |
|
| 636 | $result = $this->getNavigationResult($pos, ($current === 1), ($current === $total)); |
|
| 637 | $current = key($this->results) + 1; |
|
| 638 | ||
| 639 | if ($result === false) { |
|
| 640 | return; |
|
| 641 | } |
|
| 642 | ||
| 643 | /** @var ModelIndex $index */ |
|
| 644 | $index = $result['index']; |
|
| 645 | $resultIndex = ''; |
|
| 646 | if ($index !== null) { |
|
| 647 | $resultIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 648 | } |
|
| 649 | ||
| 650 | ||
| 651 | $width = $this->terminal->getWidth() - 13; |
|
| 652 | $message = MiscService::get('message', $result, ''); |
|
| 653 | $msg1 = substr($message, 0, $width); |
|
| 654 | $msg2 = substr($message, $width, $width + 10); |
|
| 655 | $msg3 = substr($message, $width + $width + 10, $width + 10); |
|
| 656 | ||
| 657 | ||
| 658 | $status = MiscService::get('status', $result, ''); |
|
| 659 | $type = MiscService::get('type', $result, ''); |
|
| 660 | ||
| 661 | $this->runner->setInfoArray( |
|
| 662 | [ |
|
| 663 | 'resultCurrent' => $current, |
|
| 664 | 'resultTotal' => $total, |
|
| 665 | 'resultMessageA' => trim($msg1), |
|
| 666 | 'resultMessageB' => trim($msg2), |
|
| 667 | 'resultMessageC' => trim($msg3), |
|
| 668 | 'resultStatus' => $status, |
|
| 669 | 'resultIndex' => $resultIndex |
|
| 670 | ] |
|
| 671 | ); |
|
| 672 | $this->runner->setInfoColored('resultStatus', $type); |
|
| 673 | } |
|
| 674 | ||
| 675 | ||
| 676 | /** |
|
| @@ 491-543 (lines=53) @@ | ||
| 488 | /** |
|
| 489 | * @param int $pos |
|
| 490 | */ |
|
| 491 | private function displayResult($pos = 0) { |
|
| 492 | $total = sizeof($this->results); |
|
| 493 | ||
| 494 | if ($total === 0) { |
|
| 495 | $this->runner->setInfoArray( |
|
| 496 | [ |
|
| 497 | 'resultCurrent' => 0, |
|
| 498 | 'resultTotal' => 0, |
|
| 499 | ] |
|
| 500 | ); |
|
| 501 | ||
| 502 | return; |
|
| 503 | } |
|
| 504 | ||
| 505 | $current = key($this->results) + 1; |
|
| 506 | $result = $this->getNavigationResult($pos, ($current === 1), ($current === $total)); |
|
| 507 | $current = key($this->results) + 1; |
|
| 508 | ||
| 509 | if ($result === false) { |
|
| 510 | return; |
|
| 511 | } |
|
| 512 | ||
| 513 | /** @var ModelIndex $index */ |
|
| 514 | $index = $result['index']; |
|
| 515 | $resultIndex = ''; |
|
| 516 | if ($index !== null) { |
|
| 517 | $resultIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 518 | } |
|
| 519 | ||
| 520 | ||
| 521 | $width = $this->terminal->getWidth() - 13; |
|
| 522 | $message = MiscService::get('message', $result, ''); |
|
| 523 | $msg1 = substr($message, 0, $width); |
|
| 524 | $msg2 = substr($message, $width, $width + 10); |
|
| 525 | $msg3 = substr($message, $width + $width + 10, $width + 10); |
|
| 526 | ||
| 527 | ||
| 528 | $status = MiscService::get('status', $result, ''); |
|
| 529 | $type = MiscService::get('type', $result, ''); |
|
| 530 | ||
| 531 | $this->runner->setInfoArray( |
|
| 532 | [ |
|
| 533 | 'resultCurrent' => $current, |
|
| 534 | 'resultTotal' => $total, |
|
| 535 | 'resultMessageA' => trim($msg1), |
|
| 536 | 'resultMessageB' => trim($msg2), |
|
| 537 | 'resultMessageC' => trim($msg3), |
|
| 538 | 'resultStatus' => $status, |
|
| 539 | 'resultIndex' => $resultIndex |
|
| 540 | ] |
|
| 541 | ); |
|
| 542 | $this->runner->setInfoColored('resultStatus', $type); |
|
| 543 | } |
|
| 544 | ||
| 545 | /** |
|
| 546 | * @param int $pos |
|