Code Duplication    Length = 13-14 lines in 2 locations

lib/ar/xml.php 2 locations

@@ 817-829 (lines=13) @@
814
				return $this->_appendChild( $el );
815
			} else {
816
				$pos = $this->_getPosition( $referenceEl );
817
				if ( !isset($pos) ) {
818
					$this->_appendChild( $el );
819
				} else {
820
					$this->_setParentNodes( $el );
821
					if ( !is_array( $el ) ) {
822
						$list = array( $el );
823
					} else {
824
						$list = (array) $el;
825
					}
826
					$arr = (array) $this;
827
					array_splice( $arr, $pos, 0, $list );
828
					self::__construct( $arr );
829
				}
830
			}
831
			return $el;
832
		}
@@ 837-850 (lines=14) @@
834
		function replaceChild( $el, ar_xmlNodeInterface $referenceEl ) {
835
			$this->_removeChildNodes( $el );
836
			$pos = $this->_getPosition( $referenceEl );
837
			if ( !isset($pos) ) {
838
				return null;
839
			} else {
840
				$this->_setParentNodes( $el );
841
				if ( !is_array( $el ) ) {
842
					$list = array( $el );
843
				} else {
844
					$list = (array) $el;
845
				}
846
				$arr = (array) $this;
847
				array_splice( $arr, $pos, 0, $list );
848
				self::__construct( $arr );
849
				return $this->removeChild( $referenceEl );
850
			}
851
		}
852
853
		public function removeChild( $el ) {