Code Duplication    Length = 44-44 lines in 2 locations

lib/Command/Index.php 1 location

@@ 811-854 (lines=44) @@
808
	/**
809
	 *
810
	 */
811
	private function deleteError() {
812
		$current = current($this->errors);
813
		if ($current === false) {
814
			return;
815
		}
816
817
		$this->runner->setInfoArray(
818
			[
819
				'errorMessageA'  => '',
820
				'errorMessageB'  => '',
821
				'errorMessageC'  => '',
822
				'errorException' => '',
823
				'errorIndex'     => ''
824
			]
825
		);
826
827
		$pos = key($this->errors);
828
829
		/** @var ModelIndex $index */
830
		$index = $current['index'];
831
		$this->indexService->resetErrorFromIndex($index);
832
833
		$errors = [];
834
		foreach ($this->errors as $error) {
835
			/** @var ModelIndex $errorIndex */
836
			$errorIndex = $error['index'];
837
			if ($index->getProviderId() === $errorIndex->getProviderId()
838
				&& $index->getDocumentId() === $errorIndex->getDocumentId()) {
839
				continue;
840
			}
841
842
			$errors[] = $error;
843
		}
844
845
		$this->errors = $errors;
846
		while (key($this->errors) < $pos) {
847
			if (next($this->errors) === false) {
848
				end($this->errors);
849
				break;
850
			}
851
		}
852
853
		$this->displayError();
854
	}
855
856
}
857

lib/Command/Live.php 1 location

@@ 695-738 (lines=44) @@
692
	/**
693
	 *
694
	 */
695
	private function deleteError() {
696
		$current = current($this->errors);
697
		if ($current === false) {
698
			return;
699
		}
700
701
		$this->runner->setInfoArray(
702
			[
703
				'errorMessageA'  => '',
704
				'errorMessageB'  => '',
705
				'errorMessageC'  => '',
706
				'errorException' => '',
707
				'errorIndex'     => ''
708
			]
709
		);
710
711
		$pos = key($this->errors);
712
713
		/** @var ModelIndex $index */
714
		$index = $current['index'];
715
		$this->indexService->resetErrorFromIndex($index);
716
717
		$errors = [];
718
		foreach ($this->errors as $error) {
719
			/** @var ModelIndex $errorIndex */
720
			$errorIndex = $error['index'];
721
			if ($index->getProviderId() === $errorIndex->getProviderId()
722
				&& $index->getDocumentId() === $errorIndex->getDocumentId()) {
723
				continue;
724
			}
725
726
			$errors[] = $error;
727
		}
728
729
		$this->errors = $errors;
730
		while (key($this->errors) < $pos) {
731
			if (next($this->errors) === false) {
732
				end($this->errors);
733
				break;
734
			}
735
		}
736
737
		$this->displayError();
738
	}
739
}
740
741