Code Duplication    Length = 18-18 lines in 3 locations

src/BitArray/BitArray.php 3 locations

@@ 678-695 (lines=18) @@
675
	 *
676
	 * @since   1.0.0
677
	 */
678
	public function applyOr(BitArray $bits)
679
	{
680
		if ($this->size == $bits->size)
681
		{
682
			$length = strlen($this->data);
683
684
			for ($index = 0; $index < $length; $index++)
685
			{
686
				$this->data[$index] = chr(ord($this->data[$index]) | ord($bits->data[$index]));
687
			}
688
689
			return $this;
690
		}
691
		else
692
		{
693
			throw new \InvalidArgumentException('Argument must be of equal size');
694
		}
695
	}
696
697
	/**
698
	 * And with an another bit array
@@ 708-725 (lines=18) @@
705
	 *
706
	 * @since   1.0.0
707
	 */
708
	public function applyAnd(BitArray $bits)
709
	{
710
		if ($this->size == $bits->size)
711
		{
712
			$length = strlen($this->data);
713
714
			for ($index = 0; $index < $length; $index++)
715
			{
716
				$this->data[$index] = chr(ord($this->data[$index]) & ord($bits->data[$index]));
717
			}
718
719
			return $this;
720
		}
721
		else
722
		{
723
			throw new \InvalidArgumentException('Argument must be of equal size');
724
		}
725
	}
726
727
	/**
728
	 * Xor with an another bit array
@@ 738-755 (lines=18) @@
735
	 *
736
	 * @since   1.0.0
737
	 */
738
	public function applyXor(BitArray $bits)
739
	{
740
		if ($this->size == $bits->size)
741
		{
742
			$length = strlen($this->data);
743
744
			for ($index = 0; $index < $length; $index++)
745
			{
746
				$this->data[$index] = chr(ord($this->data[$index]) ^ ord($bits->data[$index]));
747
			}
748
749
			return $this;
750
		}
751
		else
752
		{
753
			throw new \InvalidArgumentException('Argument must be of equal size');
754
		}
755
	}
756
757
	/**
758
	 * Shift a bit array.