public function __set(string $property, $value)
{
if (!\property_exists($this, $property)) {
// Use \Amp\Struct::generateStructPropertyError() to get a nice message
// with a possible suggestion for the correct name
throw new \DomainException($this->generateStructPropertyError($property));
}
if ($this->_initialized) {
throw new \RuntimeException("Cannot alter options after initialization");
}
$setter = "set" . \ucfirst($property);
if (\method_exists($this, $setter)) {
return $this->{$setter}($value);
} else {
$this->{$property} = $value;
}
}