1
1
<?php
2
2
3
- declare (strict_types=1 );
3
+ declare (strict_types=1 );
4
4
5
5
namespace NotificationChannels \Pushbullet ;
6
6
7
7
use Exception ;
8
8
use GuzzleHttp \Client as HttpClient ;
9
9
use GuzzleHttp \Exception \ClientException ;
10
10
use NotificationChannels \Pushbullet \Exceptions \CouldNotSendNotification ;
11
+ use Psr \Http \Message \ResponseInterface ;
11
12
12
13
class Pushbullet
13
14
{
@@ -23,7 +24,7 @@ class Pushbullet
23
24
* @param string $token
24
25
* @param \GuzzleHttp\Client $httpClient
25
26
*/
26
- public function __construct ($ token , HttpClient $ httpClient )
27
+ public function __construct (string $ token , HttpClient $ httpClient )
27
28
{
28
29
$ this ->token = $ token ;
29
30
$ this ->httpClient = $ httpClient ;
@@ -55,9 +56,10 @@ private function getHeaders(): array
55
56
* Send request to Pushbullet API.
56
57
*
57
58
* @param array $params
59
+ *
58
60
* @return \Psr\Http\Message\ResponseInterface
59
61
*/
60
- public function send ($ params )
62
+ public function send ($ params ): ResponseInterface
61
63
{
62
64
$ url = $ this ->getPushbulletUrl ();
63
65
@@ -67,7 +69,7 @@ public function send($params)
67
69
'headers ' => $ this ->getHeaders (),
68
70
]);
69
71
} catch (ClientException $ exception ) {
70
- throw CouldNotSendNotification::pushbulletRespondedWithAnError ($ exception );
72
+ throw CouldNotSendNotification::pushbulletRespondedWithAnError ($ exception-> getResponse () );
71
73
} catch (Exception $ exception ) {
72
74
throw CouldNotSendNotification::couldNotCommunicateWithPushbullet ();
73
75
}
0 commit comments