{$method}(); } else if (method_exists($this, $name)) { return $this->{$name}; } else { throw new Exception('Unable getting property ' . get_called_class() . '::' . $name); } } /** * @param string $name * @param $value * @return void * @throws */ public function __set(string $name, $value): void { $method = 'set' . ucfirst($name); if (method_exists($this, $method)) { $this->{$method}($value); } else if (method_exists($this, $name)) { $this->{$name} = $value; } else { throw new Exception('Unable setting property ' . get_called_class() . '::' . $name); } } }