setCode($code); $this->setMsg($msg); $this->obj = $obj; } public function __set($name, $value) { if (property_exists($this, $name)) { $this->$name = $value; } else { throw new \Exception("Property '$name' does not exist in 'Response' class."); } } public function __get($name) { if (property_exists($this, $name)) { return $this->$name; } else { throw new \Exception("Property '$name' does not exist in 'Response' class."); } } public function __isset($name) { return property_exists($this, $name); } public function setCode($code) { if (is_int($code)) { $this->code = $code; } else { throw new \Exception("Invalid code. Please provide an integer."); } } public function setMsg($msg) { if (is_string($msg)) { $this->msg = $msg; } else { throw new \Exception("Invalid msg. Please provide an string."); } } }