/** * Perform an operation on an object property. * * @param string $key Key to perform an operation upon. * @param FieldOperation $operation Operation to perform. */ public function _performOperation($key, FieldOperation $operation) { $oldValue = null; if (isset($this->estimatedData[$key])) { $oldValue = $this->estimatedData[$key]; } $newValue = $operation->_apply($oldValue, $this, $key); if ($newValue !== null) { $this->estimatedData[$key] = $newValue; } elseif (isset($this->estimatedData[$key])) { unset($this->estimatedData[$key]); } if (isset($this->operationSet[$key])) { $oldOperations = $this->operationSet[$key]; $newOperations = $operation->_mergeWithPrevious($oldOperations); $this->operationSet[$key] = $newOperations; } else { $this->operationSet[$key] = $operation; } $this->dataAvailability[$key] = true; }