File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
src/Services/NotificationManager Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -24,22 +24,25 @@ public function __construct()
24
24
}
25
25
26
26
/**
27
- * Undocumented function
27
+ * To mock
28
28
*
29
- * @param Client $client
30
- * @return void
29
+ * @param GuzzleHttp\ Client $client
30
+ * @return self
31
31
*/
32
32
public function setClient (Client $ client )
33
33
{
34
34
$ this ->client = $ client ;
35
+
36
+ return $ this ;
35
37
}
36
38
37
39
/**
38
- * Undocumented function
40
+ * Send request
39
41
*
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
43
46
*/
44
47
public function send ($ data )
45
48
{
@@ -61,9 +64,11 @@ public function send($data)
61
64
if ($ response ->getStatusCode () < 300 ) {
62
65
return json_decode ($ response ->getBody ()->getContents ());
63
66
}
67
+
64
68
if ($ response ->getStatusCode () == 503 ) {
65
69
throw new TemporaryException ("Temporal error " , 503 );
66
70
}
71
+
67
72
throw new PermanentException ("Permanent error " , $ response ->getStatusCode ());
68
73
} catch (RequestException $ e ) {
69
74
throw new TemporaryException ($ e ->getMessage (), $ e ->getCode ());
You can’t perform that action at this time.
0 commit comments