setHost($host); $this->already_init = true; } public function send(SIFRequest $request): Response { if (!$this->already_init) { $this->init(); } $now = Carbon::now(); $request->header->resultCode = ResultCode::SUCCESS->value; $request->header->sendDatetime = $now->format('YmdHis'); $data = $request->toArray(); info('SEND ' . $request->header->interfaceId, $data); $this->response = Http::post($this->getUrl($request->getPath()), $data); return $this->response; } private function setHost(string|null $host): void { if ($host !== null) { $this->host = $host; } else { $this->host = config('transmission.sif_server_url', 'https://ht_hogehoge.co.jp'); } } public function getUrl($path = null): string { $url = $this->host; if ($path !== null) { $url .= $path; } return $url; } }