| @@ 609-655 (lines=47) @@ | ||
| 606 | /** |
|
| 607 | * @param int $pos |
|
| 608 | */ |
|
| 609 | private function displayError(int $pos = 0) { |
|
| 610 | $total = sizeof($this->errors); |
|
| 611 | ||
| 612 | if ($total === 0) { |
|
| 613 | $this->runner->setInfoArray( |
|
| 614 | [ |
|
| 615 | 'errorCurrent' => 0, |
|
| 616 | 'errorTotal' => 0, |
|
| 617 | ] |
|
| 618 | ); |
|
| 619 | ||
| 620 | return; |
|
| 621 | } |
|
| 622 | ||
| 623 | try { |
|
| 624 | $current = key($this->errors) + 1; |
|
| 625 | $error = $this->getNavigationError($pos, ($current === 1), ($current === $total)); |
|
| 626 | $current = key($this->errors) + 1; |
|
| 627 | } catch (OutOfBoundsException $e) { |
|
| 628 | return; |
|
| 629 | } |
|
| 630 | ||
| 631 | /** @var ModelIndex $index */ |
|
| 632 | $index = $error['index']; |
|
| 633 | $errorIndex = ''; |
|
| 634 | if ($index !== null) { |
|
| 635 | $errorIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 636 | } |
|
| 637 | ||
| 638 | $width = $this->terminal->getWidth() - 13; |
|
| 639 | $message = $this->get('message', $error, ''); |
|
| 640 | $err1 = (string)substr($message, 0, $width); |
|
| 641 | $err2 = (string)substr($message, $width, $width + 10); |
|
| 642 | $err3 = (string)substr($message, $width + $width + 10, $width + 10); |
|
| 643 | ||
| 644 | $this->runner->setInfoArray( |
|
| 645 | [ |
|
| 646 | 'errorCurrent' => $current, |
|
| 647 | 'errorTotal' => $total, |
|
| 648 | 'errorMessageA' => trim($err1), |
|
| 649 | 'errorMessageB' => trim($err2), |
|
| 650 | 'errorMessageC' => trim($err3), |
|
| 651 | 'errorException' => $this->get('exception', $error, ''), |
|
| 652 | 'errorIndex' => $errorIndex |
|
| 653 | ] |
|
| 654 | ); |
|
| 655 | } |
|
| 656 | ||
| 657 | ||
| 658 | /** |
|
| @@ 581-627 (lines=47) @@ | ||
| 578 | /** |
|
| 579 | * @param int $pos |
|
| 580 | */ |
|
| 581 | private function displayError(int $pos = 0) { |
|
| 582 | $total = sizeof($this->errors); |
|
| 583 | ||
| 584 | if ($total === 0) { |
|
| 585 | $this->runner->setInfoArray( |
|
| 586 | [ |
|
| 587 | 'errorCurrent' => 0, |
|
| 588 | 'errorTotal' => 0, |
|
| 589 | ] |
|
| 590 | ); |
|
| 591 | ||
| 592 | return; |
|
| 593 | } |
|
| 594 | ||
| 595 | try { |
|
| 596 | $current = key($this->errors) + 1; |
|
| 597 | $error = $this->getNavigationError($pos, ($current === 1), ($current === $total)); |
|
| 598 | $current = key($this->errors) + 1; |
|
| 599 | } catch (OutOfBoundsException $e) { |
|
| 600 | return; |
|
| 601 | } |
|
| 602 | ||
| 603 | /** @var ModelIndex $index */ |
|
| 604 | $index = $error['index']; |
|
| 605 | $errorIndex = ''; |
|
| 606 | if ($index !== null) { |
|
| 607 | $errorIndex = $index->getProviderId() . ':' . $index->getDocumentId(); |
|
| 608 | } |
|
| 609 | ||
| 610 | $width = $this->terminal->getWidth() - 13; |
|
| 611 | $message = $this->get('message', $error, ''); |
|
| 612 | $err1 = (string)substr($message, 0, $width); |
|
| 613 | $err2 = (string)substr($message, $width, $width + 10); |
|
| 614 | $err3 = (string)substr($message, $width + $width + 10, $width + 10); |
|
| 615 | ||
| 616 | $this->runner->setInfoArray( |
|
| 617 | [ |
|
| 618 | 'errorCurrent' => $current, |
|
| 619 | 'errorTotal' => $total, |
|
| 620 | 'errorMessageA' => trim($err1), |
|
| 621 | 'errorMessageB' => trim($err2), |
|
| 622 | 'errorMessageC' => trim($err3), |
|
| 623 | 'errorException' => $this->get('exception', $error, ''), |
|
| 624 | 'errorIndex' => $errorIndex |
|
| 625 | ] |
|
| 626 | ); |
|
| 627 | } |
|
| 628 | ||
| 629 | ||
| 630 | /** |
|