Skip to content

Commit 2318cb2

Browse files
authored
Update NotificationManager.php
1 parent 532aca8 commit 2318cb2

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/Services/NotificationManager/NotificationManager.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,25 @@ public function __construct()
2424
}
2525

2626
/**
27-
* Undocumented function
27+
* To mock
2828
*
29-
* @param Client $client
30-
* @return void
29+
* @param GuzzleHttp\Client $client
30+
* @return self
3131
*/
3232
public function setClient(Client $client)
3333
{
3434
$this->client = $client;
35+
36+
return $this;
3537
}
3638

3739
/**
38-
* Undocumented function
40+
* Send request
3941
*
40-
* @param [type] $function
41-
* @param [type] $data
42-
* @return void
42+
* @param array $data
43+
* @throws DescomLib\Exceptions\TemporaryException
44+
* @throws DescomLib\Exceptions\PermanentException
45+
* @return object
4346
*/
4447
public function send($data)
4548
{
@@ -61,9 +64,11 @@ public function send($data)
6164
if ($response->getStatusCode() < 300) {
6265
return json_decode($response->getBody()->getContents());
6366
}
67+
6468
if ($response->getStatusCode() == 503) {
6569
throw new TemporaryException("Temporal error", 503);
6670
}
71+
6772
throw new PermanentException("Permanent error", $response->getStatusCode());
6873
} catch (RequestException $e) {
6974
throw new TemporaryException($e->getMessage(), $e->getCode());

0 commit comments

Comments
 (0)