public function setValues($data = []) { foreach ($data as $key => $value) { $method = "set" . $key; if (method_exists($this, $method)) { $this->{$method}($value); } } return $this; }