Aerys\Options::__set PHP Method

__set() public method

Prevent external code from modifying our "public" time/date properties
public __set ( string $property, mixed $value )
$property string
$value mixed
    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;
        }
    }