validateValue($defaultValue); $this->defaultValue = $defaultValue; } public function getId(): string { return $this->id; } /** * @throws Exception */ protected function validateValue($value): void { if ($this->isValidValue($value) === false) { throw new Exception("Wrong value '$value' type given for '$this->id'.'"); } } public function setValue(mixed $value): void { $this->isValidValue($value); $this->value = $value; } public function getValue(): mixed { return ($this->value === null) ? $this->defaultValue : $this->value; } }