public function __call($attr, $args = null) { if (!property_exists($this, $attr)) { throw new \Exception("Method {$attr} does not exist."); } if (count($args)) { $this->{$attr} = $args[0]; return $this; } return $this->{$attr}; }