/** * Apply operation * * @param IOperation $operation * @return void */ private function _applyOperation($operation) { $key = $operation->getKey(); $oldval = $this->get($key); $newval = $operation->applyOn($oldval, $this); if ($newval !== null) { $this->_data[$key] = $newval; } else { if (isset($this->_data[$key])) { unset($this->_data[$key]); } } $prevOp = $this->_getPreviousOp($key); $newOp = $prevOp ? $operation->mergeWith($prevOp) : $operation; $this->_operationSet[$key] = $newOp; }