Code Duplication    Length = 47-47 lines in 2 locations

lib/Command/Index.php 1 location

@@ 613-659 (lines=47) @@
610
	/**
611
	 * @param int $pos
612
	 */
613
	private function displayError(int $pos = 0) {
614
		$total = sizeof($this->errors);
615
616
		if ($total === 0) {
617
			$this->runner->setInfoArray(
618
				[
619
					'errorCurrent' => 0,
620
					'errorTotal'   => 0,
621
				]
622
			);
623
624
			return;
625
		}
626
627
		try {
628
			$current = key($this->errors) + 1;
629
			$error = $this->getNavigationError($pos, ($current === 1), ($current === $total));
630
			$current = key($this->errors) + 1;
631
		} catch (OutOfBoundsException $e) {
632
			return;
633
		}
634
635
		/** @var ModelIndex $index */
636
		$index = $error['index'];
637
		$errorIndex = '';
638
		if ($index !== null) {
639
			$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
640
		}
641
642
		$width = $this->terminal->getWidth() - 13;
643
		$message = $this->get('message', $error, '');
644
		$err1 = (string)substr($message, 0, $width);
645
		$err2 = (string)substr($message, $width, $width + 10);
646
		$err3 = (string)substr($message, $width + $width + 10, $width + 10);
647
648
		$this->runner->setInfoArray(
649
			[
650
				'errorCurrent'   => $current,
651
				'errorTotal'     => $total,
652
				'errorMessageA'  => trim($err1),
653
				'errorMessageB'  => trim($err2),
654
				'errorMessageC'  => trim($err3),
655
				'errorException' => $this->get('exception', $error, ''),
656
				'errorIndex'     => $errorIndex
657
			]
658
		);
659
	}
660
661
662
	/**

lib/Command/Live.php 1 location

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