Code Duplication    Length = 42-42 lines in 2 locations

lib/Command/Index.php 1 location

@@ 620-661 (lines=42) @@
617
	/**
618
	 *
619
	 */
620
	private function deleteError() {
621
		$current = current($this->errors);
622
		if ($current === false) {
623
			return;
624
		}
625
626
		$this->runner->setInfoArray(
627
			[
628
				'errorMessage'   => '',
629
				'errorException' => '',
630
				'errorIndex'     => ''
631
			]
632
		);
633
634
		$pos = key($this->errors);
635
636
		/** @var ModelIndex $index */
637
		$index = $current['index'];
638
		$this->indexService->resetErrorFromIndex($index);
639
640
		$errors = [];
641
		foreach ($this->errors as $error) {
642
			/** @var ModelIndex $errorIndex */
643
			$errorIndex = $error['index'];
644
			if ($index->getProviderId() === $errorIndex->getProviderId()
645
				&& $index->getDocumentId() === $errorIndex->getDocumentId()) {
646
				continue;
647
			}
648
649
			$errors[] = $error;
650
		}
651
652
		$this->errors = $errors;
653
		while (key($this->errors) < $pos) {
654
			if (next($this->errors) === false) {
655
				end($this->errors);
656
				break;
657
			}
658
		}
659
660
		$this->displayError();
661
	}
662
663
}
664

lib/Command/Live.php 1 location

@@ 509-550 (lines=42) @@
506
	/**
507
	 *
508
	 */
509
	private function deleteError() {
510
		$current = current($this->errors);
511
		if ($current === false) {
512
			return;
513
		}
514
515
		$this->runner->setInfoArray(
516
			[
517
				'errorMessage'   => '',
518
				'errorException' => '',
519
				'errorIndex'     => ''
520
			]
521
		);
522
523
		$pos = key($this->errors);
524
525
		/** @var ModelIndex $index */
526
		$index = $current['index'];
527
		$this->indexService->resetErrorFromIndex($index);
528
529
		$errors = [];
530
		foreach ($this->errors as $error) {
531
			/** @var ModelIndex $errorIndex */
532
			$errorIndex = $error['index'];
533
			if ($index->getProviderId() === $errorIndex->getProviderId()
534
				&& $index->getDocumentId() === $errorIndex->getDocumentId()) {
535
				continue;
536
			}
537
538
			$errors[] = $error;
539
		}
540
541
		$this->errors = $errors;
542
		while (key($this->errors) < $pos) {
543
			if (next($this->errors) === false) {
544
				end($this->errors);
545
				break;
546
			}
547
		}
548
549
		$this->displayError();
550
	}
551
}
552
553