Code Duplication    Length = 53-53 lines in 2 locations

lib/Command/Index.php 1 location

@@ 651-703 (lines=53) @@
648
	/**
649
	 * @param int $pos
650
	 */
651
	private function displayResult($pos = 0) {
652
		$total = sizeof($this->results);
653
654
		if ($total === 0) {
655
			$this->runner->setInfoArray(
656
				[
657
					'resultCurrent' => 0,
658
					'resultTotal'   => 0,
659
				]
660
			);
661
662
			return;
663
		}
664
665
		$current = key($this->results) + 1;
666
		$result = $this->getNavigationResult($pos, ($current === 1), ($current === $total));
667
		$current = key($this->results) + 1;
668
669
		if ($result === false) {
670
			return;
671
		}
672
673
		/** @var ModelIndex $index */
674
		$index = $result['index'];
675
		$resultIndex = '';
676
		if ($index !== null) {
677
			$resultIndex = $index->getProviderId() . ':' . $index->getDocumentId();
678
		}
679
680
681
		$width = $this->terminal->getWidth() - 13;
682
		$message = MiscService::get('message', $result, '');
683
		$msg1 = substr($message, 0, $width);
684
		$msg2 = substr($message, $width, $width + 10);
685
		$msg3 = substr($message, $width + $width + 10, $width + 10);
686
687
688
		$status = MiscService::get('status', $result, '');
689
		$type = MiscService::get('type', $result, '');
690
691
		$this->runner->setInfoArray(
692
			[
693
				'resultCurrent'  => $current,
694
				'resultTotal'    => $total,
695
				'resultMessageA' => trim($msg1),
696
				'resultMessageB' => trim($msg2),
697
				'resultMessageC' => trim($msg3),
698
				'resultStatus'   => $status,
699
				'resultIndex'    => $resultIndex
700
			]
701
		);
702
		$this->runner->setInfoColored('resultStatus', $type);
703
	}
704
705
706
	/**

lib/Command/Live.php 1 location

@@ 506-558 (lines=53) @@
503
	/**
504
	 * @param int $pos
505
	 */
506
	private function displayResult($pos = 0) {
507
		$total = sizeof($this->results);
508
509
		if ($total === 0) {
510
			$this->runner->setInfoArray(
511
				[
512
					'resultCurrent' => 0,
513
					'resultTotal'   => 0,
514
				]
515
			);
516
517
			return;
518
		}
519
520
		$current = key($this->results) + 1;
521
		$result = $this->getNavigationResult($pos, ($current === 1), ($current === $total));
522
		$current = key($this->results) + 1;
523
524
		if ($result === false) {
525
			return;
526
		}
527
528
		/** @var ModelIndex $index */
529
		$index = $result['index'];
530
		$resultIndex = '';
531
		if ($index !== null) {
532
			$resultIndex = $index->getProviderId() . ':' . $index->getDocumentId();
533
		}
534
535
536
		$width = $this->terminal->getWidth() - 13;
537
		$message = MiscService::get('message', $result, '');
538
		$msg1 = substr($message, 0, $width);
539
		$msg2 = substr($message, $width, $width + 10);
540
		$msg3 = substr($message, $width + $width + 10, $width + 10);
541
542
543
		$status = MiscService::get('status', $result, '');
544
		$type = MiscService::get('type', $result, '');
545
546
		$this->runner->setInfoArray(
547
			[
548
				'resultCurrent'  => $current,
549
				'resultTotal'    => $total,
550
				'resultMessageA' => trim($msg1),
551
				'resultMessageB' => trim($msg2),
552
				'resultMessageC' => trim($msg3),
553
				'resultStatus'   => $status,
554
				'resultIndex'    => $resultIndex
555
			]
556
		);
557
		$this->runner->setInfoColored('resultStatus', $type);
558
	}
559
560
	/**
561
	 * @param int $pos