Code Duplication    Length = 18-18 lines in 3 locations

src/BitArray/BitArray.php 3 locations

@@ 624-641 (lines=18) @@
621
	 *
622
	 * @since   1.0.0
623
	 */
624
	public function applyOr(BitArray $bits)
625
	{
626
		if ($this->size == $bits->size)
627
		{
628
			$length = strlen($this->data);
629
630
			for ($index = 0; $index < $length; $index++)
631
			{
632
				$this->data[$index] = chr(ord($this->data[$index]) | ord($bits->data[$index]));
633
			}
634
635
			return $this;
636
		}
637
		else
638
		{
639
			throw new \InvalidArgumentException('Argument must be of equal size');
640
		}
641
	}
642
643
	/**
644
	 * And with an another bit array
@@ 654-671 (lines=18) @@
651
	 *
652
	 * @since   1.0.0
653
	 */
654
	public function applyAnd(BitArray $bits)
655
	{
656
		if ($this->size == $bits->size)
657
		{
658
			$length = strlen($this->data);
659
660
			for ($index = 0; $index < $length; $index++)
661
			{
662
				$this->data[$index] = chr(ord($this->data[$index]) & ord($bits->data[$index]));
663
			}
664
665
			return $this;
666
		}
667
		else
668
		{
669
			throw new \InvalidArgumentException('Argument must be of equal size');
670
		}
671
	}
672
673
	/**
674
	 * Xor with an another bit array
@@ 684-701 (lines=18) @@
681
	 *
682
	 * @since   1.0.0
683
	 */
684
	public function applyXor(BitArray $bits)
685
	{
686
		if ($this->size == $bits->size)
687
		{
688
			$length = strlen($this->data);
689
690
			for ($index = 0; $index < $length; $index++)
691
			{
692
				$this->data[$index] = chr(ord($this->data[$index]) ^ ord($bits->data[$index]));
693
			}
694
695
			return $this;
696
		}
697
		else
698
		{
699
			throw new \InvalidArgumentException('Argument must be of equal size');
700
		}
701
	}
702
}
703