Code Duplication    Length = 47-47 lines in 2 locations

lib/Command/Index.php 1 location

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

lib/Command/Live.php 1 location

@@ 563-609 (lines=47) @@
560
	/**
561
	 * @param int $pos
562
	 */
563
	private function displayError($pos = 0) {
564
		$total = sizeof($this->errors);
565
566
		if ($total === 0) {
567
			$this->runner->setInfoArray(
568
				[
569
					'errorCurrent' => 0,
570
					'errorTotal'   => 0,
571
				]
572
			);
573
574
			return;
575
		}
576
577
		$current = key($this->errors) + 1;
578
		$error = $this->getNavigationError($pos, ($current === 1), ($current === $total));
579
		$current = key($this->errors) + 1;
580
581
		if ($error === false) {
582
			return;
583
		}
584
585
		/** @var ModelIndex $index */
586
		$index = $error['index'];
587
		$errorIndex = '';
588
		if ($index !== null) {
589
			$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
590
		}
591
592
		$width = $this->terminal->getWidth() - 13;
593
		$message = MiscService::get('message', $error, '');
594
		$err1 = substr($message, 0, $width);
595
		$err2 = substr($message, $width, $width + 10);
596
		$err3 = substr($message, $width + $width + 10, $width + 10);
597
598
		$this->runner->setInfoArray(
599
			[
600
				'errorCurrent'   => $current,
601
				'errorTotal'     => $total,
602
				'errorMessageA'  => trim($err1),
603
				'errorMessageB'  => trim($err2),
604
				'errorMessageC'  => trim($err3),
605
				'errorException' => MiscService::get('exception', $error, ''),
606
				'errorIndex'     => $errorIndex
607
			]
608
		);
609
	}
610
611
612
	/**