populateFromArray($options); foreach ([ 'paramsGet', 'paramsPost', 'paramsPut', 'paramsDelete', 'headers' ] as $param) { if (!($this->$param instanceof Params)) { $this->$param = new Params(!is_array($this->$param) ? [] : $this->$param); } } $this->headers->add('X-API-KEY', $this->getConfig()->getApiKey()); } /** * Whether the request method is a GET method. * * @return bool */ public function getIsGetMethod(): bool { return strtoupper($this->method) === self::METHOD_GET; } /** * Whether the request method is a POST method. * * @return bool */ public function getIsPostMethod(): bool { return strtoupper($this->method) === self::METHOD_POST; } /** * Whether the request method is a PUT method. * * @return bool */ public function getIsPutMethod(): bool { return strtoupper($this->method) === self::METHOD_PUT; } /** * Whether the request method is a DELETE method. * * @return bool */ public function getIsDeleteMethod(): bool { return strtoupper($this->method) === self::METHOD_DELETE; } /** * Makes the request to the remote host. * * @return Response * @throws Exception */ public function request(): Response { $request = new Request($this); return $response = $request->send(); } }