Code Duplication    Length = 44-44 lines in 2 locations

lib/Command/Index.php 1 location

@@ 642-685 (lines=44) @@
639
	/**
640
	 *
641
	 */
642
	private function deleteError() {
643
		$current = current($this->errors);
644
		if ($current === false) {
645
			return;
646
		}
647
648
		$this->runner->setInfoArray(
649
			[
650
				'errorMessageA'  => '',
651
				'errorMessageB'  => '',
652
				'errorMessageC'  => '',
653
				'errorException' => '',
654
				'errorIndex'     => ''
655
			]
656
		);
657
658
		$pos = key($this->errors);
659
660
		/** @var ModelIndex $index */
661
		$index = $current['index'];
662
		$this->indexService->resetErrorFromIndex($index);
663
664
		$errors = [];
665
		foreach ($this->errors as $error) {
666
			/** @var ModelIndex $errorIndex */
667
			$errorIndex = $error['index'];
668
			if ($index->getProviderId() === $errorIndex->getProviderId()
669
				&& $index->getDocumentId() === $errorIndex->getDocumentId()) {
670
				continue;
671
			}
672
673
			$errors[] = $error;
674
		}
675
676
		$this->errors = $errors;
677
		while (key($this->errors) < $pos) {
678
			if (next($this->errors) === false) {
679
				end($this->errors);
680
				break;
681
			}
682
		}
683
684
		$this->displayError();
685
	}
686
687
}
688

lib/Command/Live.php 1 location

@@ 547-590 (lines=44) @@
544
	/**
545
	 *
546
	 */
547
	private function deleteError() {
548
		$current = current($this->errors);
549
		if ($current === false) {
550
			return;
551
		}
552
553
		$this->runner->setInfoArray(
554
			[
555
				'errorMessageA'  => '',
556
				'errorMessageB'  => '',
557
				'errorMessageC'  => '',
558
				'errorException' => '',
559
				'errorIndex'     => ''
560
			]
561
		);
562
563
		$pos = key($this->errors);
564
565
		/** @var ModelIndex $index */
566
		$index = $current['index'];
567
		$this->indexService->resetErrorFromIndex($index);
568
569
		$errors = [];
570
		foreach ($this->errors as $error) {
571
			/** @var ModelIndex $errorIndex */
572
			$errorIndex = $error['index'];
573
			if ($index->getProviderId() === $errorIndex->getProviderId()
574
				&& $index->getDocumentId() === $errorIndex->getDocumentId()) {
575
				continue;
576
			}
577
578
			$errors[] = $error;
579
		}
580
581
		$this->errors = $errors;
582
		while (key($this->errors) < $pos) {
583
			if (next($this->errors) === false) {
584
				end($this->errors);
585
				break;
586
			}
587
		}
588
589
		$this->displayError();
590
	}
591
}
592
593