@@ -20,57 +20,57 @@ class Requester
2020 protected $ config = [];
2121
2222 /**
23- * Url
23+ * Url.
2424 *
2525 * @var string
2626 */
2727 protected $ url = null ;
2828
2929 /**
30- * Options for request
30+ * Options for request.
3131 *
3232 * @var array
3333 */
3434 protected $ options = [];
3535
3636 /**
37- * Send secure request or not
37+ * Send secure request or not.
3838 *
3939 * @var boolean
4040 */
4141 protected $ secure = true ;
4242
4343 /**
44- * Verify ssl connection
44+ * Verify ssl connection.
4545 *
4646 * @var boolean|string
4747 */
4848 protected $ verify = true ;
4949
5050 /**
51- * Make request asynchronously
51+ * Make request asynchronously.
5252 *
5353 * @var boolean
5454 */
5555 protected $ async = false ;
5656
5757 /**
58- * Retry request on which types of errors
58+ * Retry request on which types of errors.
5959 *
6060 * @var array
6161 */
6262 protected $ retryOn = [500 , 502 , 503 , 504 ];
6363
6464 /**
6565 * Delay between requests
66- * In miliseconds
66+ * In miliseconds.
6767 *
6868 * @var integer
6969 */
7070 protected $ retryDelay = 10 ;
7171
7272 /**
73- * Number of times to retry
73+ * Number of times to retry.
7474 *
7575 * @var integer
7676 */
@@ -89,7 +89,7 @@ public function __construct(GuzzleClient $guzzleClient, array $config = [])
8989 }
9090
9191 /**
92- * Getter for guzzle client
92+ * Getter for guzzle client.
9393 *
9494 * @return \GuzzleHttp\Client
9595 */
@@ -105,10 +105,11 @@ public function getGuzzleClient()
105105 }
106106
107107 /**
108- * Add a logger to the guzzle client
108+ * Add a logger to the guzzle client.
109+ *
110+ * @param Logger $logger PSR-3 Logger instance (monolog)
111+ * @param string $format Log output format
109112 *
110- * @param Logger $logger PSR-3 Logger instance (monolog)
111- * @param string $format Log output format
112113 * @return void
113114 */
114115 public function addLogger ($ logger , $ format = 'CLF ' )
@@ -123,7 +124,7 @@ public function addLogger($logger, $format = 'CLF')
123124
124125 /**
125126 * Set the url
126- * will automatically append the protocol
127+ * will automatically append the protocol.
127128 *
128129 * @return \PulkitJalan\Requester\Requester
129130 */
@@ -135,9 +136,10 @@ public function url($url)
135136 }
136137
137138 /**
138- * Use secure endpoint or not
139+ * Use secure endpoint or not.
140+ *
141+ * @param boolean $secure
139142 *
140- * @param boolean $secure
141143 * @return \PulkitJalan\Requester\Requester
142144 */
143145 public function secure ($ secure )
@@ -148,9 +150,10 @@ public function secure($secure)
148150 }
149151
150152 /**
151- * Verify ssl or not
153+ * Verify ssl or not.
154+ *
155+ * @param boolean|string $verify boolean or path to certificate
152156 *
153- * @param boolean|string $verify boolean or path to certificate
154157 * @return \PulkitJalan\Requester\Requester
155158 */
156159 public function verify ($ verify )
@@ -161,9 +164,10 @@ public function verify($verify)
161164 }
162165
163166 /**
164- * Make request asynchronously
167+ * Make request asynchronously.
168+ *
169+ * @param boolean $async
165170 *
166- * @param boolean $async
167171 * @return \PulkitJalan\Requester\Requester
168172 */
169173 public function async ($ async )
@@ -174,9 +178,10 @@ public function async($async)
174178 }
175179
176180 /**
177- * Set headers for the request
181+ * Set headers for the request.
182+ *
183+ * @param array $headers
178184 *
179- * @param array $headers
180185 * @return \PulkitJalan\Requester\Requester
181186 */
182187 public function headers (array $ headers )
@@ -187,9 +192,10 @@ public function headers(array $headers)
187192 }
188193
189194 /**
190- * Number if times to retry
195+ * Number if times to retry.
196+ *
197+ * @param int $retry times to retry
191198 *
192- * @param int $retry times to retry
193199 * @return \PulkitJalan\Requester\Requester
194200 */
195201 public function retry ($ retry )
@@ -200,9 +206,10 @@ public function retry($retry)
200206 }
201207
202208 /**
203- * Delay between retrying
209+ * Delay between retrying.
210+ *
211+ * @param int $retryDelay delay between retrying
204212 *
205- * @param int $retryDelay delay between retrying
206213 * @return \PulkitJalan\Requester\Requester
207214 */
208215 public function every ($ retryDelay )
@@ -213,9 +220,10 @@ public function every($retryDelay)
213220 }
214221
215222 /**
216- * Types of errors to retry on
223+ * Types of errors to retry on.
224+ *
225+ * @param array $retryOn errors to retry on
217226 *
218- * @param array $retryOn errors to retry on
219227 * @return \PulkitJalan\Requester\Requester
220228 */
221229 public function on (array $ retryOn )
@@ -226,27 +234,29 @@ public function on(array $retryOn)
226234 }
227235
228236 /**
229- * Add a file to the request
237+ * Add a file to the request.
238+ *
239+ * @param string $filepath path to file
240+ * @param string $key optional post key, default to file
230241 *
231- * @param string $filepath path to file
232- * @param string $key optional post key, default to file
233242 * @return \PulkitJalan\Requester\Requester
234243 */
235244 public function addFile ($ filepath , $ key = 'file ' )
236245 {
237246 $ this ->options = array_merge_recursive ($ this ->options , [
238247 'body ' => [
239248 $ key => fopen ($ filepath , 'r ' ),
240- ]
249+ ],
241250 ]);
242251
243252 return $ this ;
244253 }
245254
246255 /**
247- * Send get request
256+ * Send get request.
257+ *
258+ * @param array $options
248259 *
249- * @param array $options
250260 * @return \GuzzleHttp\Message\ResponseInterface
251261 */
252262 public function get (array $ options = [])
@@ -255,9 +265,10 @@ public function get(array $options = [])
255265 }
256266
257267 /**
258- * Send head request
268+ * Send head request.
269+ *
270+ * @param array $options
259271 *
260- * @param array $options
261272 * @return \GuzzleHttp\Message\ResponseInterface
262273 */
263274 public function head (array $ options = [])
@@ -266,9 +277,10 @@ public function head(array $options = [])
266277 }
267278
268279 /**
269- * Send delete request
280+ * Send delete request.
281+ *
282+ * @param array $options
270283 *
271- * @param array $options
272284 * @return \GuzzleHttp\Message\ResponseInterface
273285 */
274286 public function delete (array $ options = [])
@@ -277,9 +289,10 @@ public function delete(array $options = [])
277289 }
278290
279291 /**
280- * Send put request
292+ * Send put request.
293+ *
294+ * @param array $options
281295 *
282- * @param array $options
283296 * @return \GuzzleHttp\Message\ResponseInterface
284297 */
285298 public function put (array $ options = [])
@@ -288,9 +301,10 @@ public function put(array $options = [])
288301 }
289302
290303 /**
291- * Send patch request
304+ * Send patch request.
305+ *
306+ * @param array $options
292307 *
293- * @param array $options
294308 * @return \GuzzleHttp\Message\ResponseInterface
295309 */
296310 public function patch (array $ options = [])
@@ -299,9 +313,10 @@ public function patch(array $options = [])
299313 }
300314
301315 /**
302- * Send post request
316+ * Send post request.
317+ *
318+ * @param array $options
303319 *
304- * @param array $options
305320 * @return \GuzzleHttp\Message\ResponseInterface
306321 */
307322 public function post (array $ options = [])
@@ -310,9 +325,10 @@ public function post(array $options = [])
310325 }
311326
312327 /**
313- * Send options request
328+ * Send options request.
329+ *
330+ * @param array $options
314331 *
315- * @param array $options
316332 * @return \GuzzleHttp\Message\ResponseInterface
317333 */
318334 public function options (array $ options = [])
@@ -321,7 +337,7 @@ public function options(array $options = [])
321337 }
322338
323339 /**
324- * Getter for the url will append protocol if one does not exist
340+ * Getter for the url will append protocol if one does not exist.
325341 *
326342 * @return string
327343 */
@@ -341,7 +357,7 @@ public function getUrl()
341357 }
342358
343359 /**
344- * Getter for options
360+ * Getter for options.
345361 *
346362 * @return array
347363 */
@@ -359,10 +375,11 @@ public function getOptions($options)
359375 }
360376
361377 /**
362- * Send the request using guzzle
378+ * Send the request using guzzle.
379+ *
380+ * @param string $function function to call on guzzle
381+ * @param array $options options to pass
363382 *
364- * @param string $function function to call on guzzle
365- * @param array $options options to pass
366383 * @return \GuzzleHttp\Message\ResponseInterface
367384 */
368385 protected function send ($ function , array $ options = [])
@@ -381,17 +398,18 @@ protected function send($function, array $options = [])
381398 }
382399
383400 /**
384- * Add the retry subscriber to the guzzle client
401+ * Add the retry subscriber to the guzzle client.
402+ *
403+ * @param \GuzzleHttp\Client $guzzle
385404 *
386- * @param \GuzzleHttp\Client $guzzle
387405 * @return \GuzzleHttp\Client
388406 */
389407 protected function addRetrySubscriber (GuzzleClient $ guzzle )
390408 {
391409 // Build retry subscriber
392410 $ retry = new RetrySubscriber ([
393411 'filter ' => RetrySubscriber::createStatusFilter ($ this ->retryOn ),
394- 'delay ' => function ($ number , $ event ) {
412+ 'delay ' => function ($ number , $ event ) {
395413 return $ this ->retryDelay ;
396414 },
397415 'max ' => $ this ->retry ,
@@ -404,7 +422,7 @@ protected function addRetrySubscriber(GuzzleClient $guzzle)
404422 }
405423
406424 /**
407- * Get the protocol
425+ * Get the protocol.
408426 *
409427 * @return string
410428 */
@@ -415,7 +433,7 @@ protected function getProtocol()
415433
416434 /**
417435 * Resets all variables to default values
418- * required if using the same instance for multiple requests
436+ * required if using the same instance for multiple requests.
419437 *
420438 * @return void
421439 */
0 commit comments