data = $data; return $this; } public function setExtra($extraKey = '', $value = '') { $this->extra[$extraKey] = $value; return $this; } public function setCode(int $code) { $this->code = $code; return $this; } public function setMsg(string $message) { $this->msg = $message; return $this; } public function send() { $resp = [ 'code' => $this->code, 'msg' => $this->msg, 'data' => $this->data, ]; if ($this->extra) { foreach ($this->extra as $key => $item) { $resp[$key] = $item; } } return $resp; } }