public function offsetSet($property, $value) { if (property_exists($this, $property)) { $this->{$property} = $value; } else { throw new \RuntimeException("Property '{$property}' doesn't exist!"); } }