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 );
		}
	}