Property = $property; $this->DefaultValue = $defaultValue; $this->Required = $required; } public function Sanitize($originalObject, $newObject) { if(isset($originalObject->{$this->Property})) { $newObject->{$this->Property} = $this->InternalSerialize($originalObject, $newObject); } else { if($this->Required) $newObject->{$this->Property} = $this->DefaultValue; } } protected abstract function InternalSerialize($originalObject, $newObject); }