Code Duplication    Length = 31-31 lines in 4 locations

lib/Command/Index.php 2 locations

@@ 713-743 (lines=31) @@
710
	 *
711
	 * @return bool|array
712
	 */
713
	private function getNavigationError($pos, $isFirst, $isLast) {
714
715
		if ($pos === 0) {
716
			if ($this->navigateLastError === true) {
717
				return end($this->errors);
718
			} else {
719
				return current($this->errors);
720
			}
721
		}
722
723
		$this->navigateLastError = false;
724
		if ($pos === -99) {
725
			return reset($this->errors);
726
		}
727
728
		if ($pos === -1 && !$isFirst) {
729
			return prev($this->errors);
730
		}
731
732
		if ($pos === 1 && !$isLast) {
733
			return next($this->errors);
734
		}
735
736
		if ($pos === 99) {
737
			$this->navigateLastError = true;
738
739
			return end($this->errors);
740
		}
741
742
		return false;
743
	}
744
745
746
	/**
@@ 753-783 (lines=31) @@
750
	 *
751
	 * @return bool|array
752
	 */
753
	private function getNavigationResult($pos, $isFirst, $isLast) {
754
755
		if ($pos === 0) {
756
			if ($this->navigateLastResult === true) {
757
				return end($this->results);
758
			} else {
759
				return current($this->results);
760
			}
761
		}
762
763
		$this->navigateLastResult = false;
764
		if ($pos === -99) {
765
			return reset($this->results);
766
		}
767
768
		if ($pos === -1 && !$isFirst) {
769
			return prev($this->results);
770
		}
771
772
		if ($pos === 1 && !$isLast) {
773
			return next($this->results);
774
		}
775
776
		if ($pos === 99) {
777
			$this->navigateLastResult = true;
778
779
			return end($this->results);
780
		}
781
782
		return false;
783
	}
784
785
786
	/**

lib/Command/Live.php 2 locations

@@ 619-649 (lines=31) @@
616
	 *
617
	 * @return bool|array
618
	 */
619
	private function getNavigationResult($pos, $isFirst, $isLast) {
620
621
		if ($pos === 0) {
622
			if ($this->navigateLastResult === true) {
623
				return end($this->results);
624
			} else {
625
				return current($this->results);
626
			}
627
		}
628
629
		$this->navigateLastResult = false;
630
		if ($pos === -99) {
631
			return reset($this->results);
632
		}
633
634
		if ($pos === -1 && !$isFirst) {
635
			return prev($this->results);
636
		}
637
638
		if ($pos === 1 && !$isLast) {
639
			return next($this->results);
640
		}
641
642
		if ($pos === 99) {
643
			$this->navigateLastResult = true;
644
645
			return end($this->results);
646
		}
647
648
		return false;
649
	}
650
651
652
	/**
@@ 659-689 (lines=31) @@
656
	 *
657
	 * @return bool|array
658
	 */
659
	private function getNavigationError($pos, $isFirst, $isLast) {
660
661
		if ($pos === 0) {
662
			if ($this->navigateLastError === true) {
663
				return end($this->errors);
664
			} else {
665
				return current($this->errors);
666
			}
667
		}
668
669
		$this->navigateLastError = false;
670
		if ($pos === -99) {
671
			return reset($this->errors);
672
		}
673
674
		if ($pos === -1 && !$isFirst) {
675
			return prev($this->errors);
676
		}
677
678
		if ($pos === 1 && !$isLast) {
679
			return next($this->errors);
680
		}
681
682
		if ($pos === 99) {
683
			$this->navigateLastError = true;
684
685
			return end($this->errors);
686
		}
687
688
		return false;
689
	}
690
691
692
	/**