Skip to content

Commit 5ce068c

Browse files
committed
Add comment, add type hint, make optional in post()
1 parent b36d2a7 commit 5ce068c

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/Client.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,52 @@ public function __construct(...$args)
165165
$this->client = $this->createHttpClient($options);
166166
}
167167

168+
/**
169+
* Create HTTP client
170+
*
171+
* @param array $options
172+
* @return HttpClient
173+
*/
168174
private function createHttpClient(array $options): HttpClient
169175
{
170176
return new HttpClient($options);
171177
}
172178

173-
public function get($endpoint, array $headers = []): Response
179+
/**
180+
* Performe GET request
181+
*
182+
* @param string $endpoint
183+
* @param array $headers
184+
* @return Response
185+
*/
186+
public function get(string $endpoint, array $headers = []): Response
174187
{
175188
return $this->client->get($endpoint, [
176189
'headers' => $headers,
177190
]);
178191
}
179192

180-
public function post($endpoint, array $payloads, array $headers = []): Response
193+
/**
194+
* Performe POST request
195+
*
196+
* @param string $endpoint
197+
* @param array $payloads
198+
* @param array $headers
199+
* @return Response
200+
*/
201+
public function post(string $endpoint, array $payloads = [], array $headers = []): Response
181202
{
182203
return $this->client->post($endpoint, [
183204
'json' => $payloads,
184205
'headers' => $headers,
185206
]);
186207
}
187208

209+
/**
210+
* Get debug data
211+
*
212+
* @return object
213+
*/
188214
public function debugs(): object
189215
{
190216
return (object) $this->debugs;

0 commit comments

Comments
 (0)