request($method, sprintf('%s%s', self::REST_PATH_PREFX, $uri), $options); } protected function callApiWithKey(string $method, string $uri, array $options = []): ResponseInterface { $headers = $options[RequestOptions::HEADERS] ?? []; $headers[ApiKeyHeaderPlugin::HEADER_NAME] = 'valid_api_key'; $options[RequestOptions::HEADERS] = $headers; return $this->callApi($method, $uri, $options); } protected function getJsonResponsePayload(ResponseInterface $resp): array { return json_decode((string) $resp->getBody()); } protected function callShortUrl(string $shortCode): ResponseInterface { return self::$client->request(self::METHOD_GET, sprintf('/%s', $shortCode), [ RequestOptions::ALLOW_REDIRECTS => false, ]); } }