Code Duplication    Length = 47-47 lines in 2 locations

lib/Command/Index.php 1 location

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

lib/Command/Live.php 1 location

@@ 548-594 (lines=47) @@
545
	/**
546
	 * @param int $pos
547
	 */
548
	private function displayError($pos = 0) {
549
		$total = sizeof($this->errors);
550
551
		if ($total === 0) {
552
			$this->runner->setInfoArray(
553
				[
554
					'errorCurrent' => 0,
555
					'errorTotal'   => 0,
556
				]
557
			);
558
559
			return;
560
		}
561
562
		$current = key($this->errors) + 1;
563
		$error = $this->getNavigationError($pos, ($current === 1), ($current === $total));
564
		$current = key($this->errors) + 1;
565
566
		if ($error === false) {
567
			return;
568
		}
569
570
		/** @var ModelIndex $index */
571
		$index = $error['index'];
572
		$errorIndex = '';
573
		if ($index !== null) {
574
			$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
575
		}
576
577
		$width = $this->terminal->getWidth() - 13;
578
		$message = MiscService::get('message', $error, '');
579
		$err1 = substr($message, 0, $width);
580
		$err2 = substr($message, $width, $width + 10);
581
		$err3 = substr($message, $width + $width + 10, $width + 10);
582
583
		$this->runner->setInfoArray(
584
			[
585
				'errorCurrent'   => $current,
586
				'errorTotal'     => $total,
587
				'errorMessageA'  => trim($err1),
588
				'errorMessageB'  => trim($err2),
589
				'errorMessageC'  => trim($err3),
590
				'errorException' => MiscService::get('exception', $error, ''),
591
				'errorIndex'     => $errorIndex
592
			]
593
		);
594
	}
595
596
597
	/**