private function setElement( $index, $value ) {
		if ( !( $value instanceof DiffOp ) ) {
			throw new InvalidArgumentException(
				'Can only add DiffOp implementing objects to ' . get_called_class() . '.'
			);
		}

		if ( $index === null ) {
			$index = $this->getNewOffset();
		}

		if ( $this->preSetElement( $index, $value ) ) {
			parent::offsetSet( $index, $value );
		}
	}
private function setElement( $index, $value ) {
		if ( !( $value instanceof DiffOp ) ) {
			throw new InvalidArgumentException(
				'Can only add DiffOp implementing objects to ' . get_called_class() . '.'
			);
		}

		if ( $index === null ) {
			$index = $this->getNewOffset();
		}

		if ( $this->preSetElement( $index, $value ) ) {
			parent::offsetSet( $index, $value );
		}
	}
private function setElement ( $ index , $ value ) { if ( ! ( $ value instanceof DiffOp ) ) { throw new InvalidArgumentException ( 'Can only add DiffOp implementing objects to ' . get_called_class ( ) . '.' ) ; } if ( $ index === null ) { $ index = $ this -> getNewOffset ( ) ; } if ( $ this -> preSetElement ( $ index , $ value ) ) { parent :: offsetSet ( $ index , $ value ) ; } }
Method that actually sets the element and holds
all common code needed for set operations, including
type checking and offset resolving.

If you want to do additional indexing or have code that
otherwise needs to be executed whenever an element is added,
you can overload @see preSetElement.

@param int|string|null $index
@param mixed $value

@throws InvalidArgumentException
Method that actually sets the element and holds all common code needed for set operations including type checking and offset resolving .