public function _mergeWithPrevious($previous)
    {
        if (!$previous)
        {
            return $this;
        }
        if ($previous instanceof DeleteOperation)
        {
            return new SetOperation($this->value);
        }
        if ($previous instanceof SetOperation)
        {
            return new SetOperation($previous->getValue() + $this->value);
        }
        if ($previous instanceof IncrementOperation)
        {
            return new IncrementOperation($previous->getValue() + $this->value);
        }
        throw new AVException('Operation is invalid after previous operation.');
    }
public function _mergeWithPrevious($previous)
    {
        if (!$previous)
        {
            return $this;
        }
        if ($previous instanceof DeleteOperation)
        {
            return new SetOperation($this->value);
        }
        if ($previous instanceof SetOperation)
        {
            return new SetOperation($previous->getValue() + $this->value);
        }
        if ($previous instanceof IncrementOperation)
        {
            return new IncrementOperation($previous->getValue() + $this->value);
        }
        throw new AVException('Operation is invalid after previous operation.');
    }
public function _mergeWithPrevious ( $ previous ) { if ( ! $ previous ) { return $ this ; } if ( $ previous instanceof DeleteOperation ) { return new SetOperation ( $ this -> value ) ; } if ( $ previous instanceof SetOperation ) { return new SetOperation ( $ previous -> getValue ( ) + $ this -> value ) ; } if ( $ previous instanceof IncrementOperation ) { return new IncrementOperation ( $ previous -> getValue ( ) + $ this -> value ) ; } throw new AVException ( 'Operation is invalid after previous operation.' ) ; }
Merge this operation with a previous operation and return the
resulting operation.

@param FieldOperation $previous Previous Operation.

@return FieldOperation
@throws AVException
Merge this operation with a previous operation and return the resulting operation .