11<?php
22
3- declare (strict_types=1 );
3+ declare (strict_types=1 );
44
55namespace NotificationChannels \Pushbullet ;
66
77use Exception ;
88use GuzzleHttp \Client as HttpClient ;
99use GuzzleHttp \Exception \ClientException ;
1010use NotificationChannels \Pushbullet \Exceptions \CouldNotSendNotification ;
11+ use Psr \Http \Message \ResponseInterface ;
1112
1213class Pushbullet
1314{
@@ -23,7 +24,7 @@ class Pushbullet
2324 * @param string $token
2425 * @param \GuzzleHttp\Client $httpClient
2526 */
26- public function __construct ($ token , HttpClient $ httpClient )
27+ public function __construct (string $ token , HttpClient $ httpClient )
2728 {
2829 $ this ->token = $ token ;
2930 $ this ->httpClient = $ httpClient ;
@@ -55,9 +56,10 @@ private function getHeaders(): array
5556 * Send request to Pushbullet API.
5657 *
5758 * @param array $params
59+ *
5860 * @return \Psr\Http\Message\ResponseInterface
5961 */
60- public function send ($ params )
62+ public function send ($ params ): ResponseInterface
6163 {
6264 $ url = $ this ->getPushbulletUrl ();
6365
@@ -67,7 +69,7 @@ public function send($params)
6769 'headers ' => $ this ->getHeaders (),
6870 ]);
6971 } catch (ClientException $ exception ) {
70- throw CouldNotSendNotification::pushbulletRespondedWithAnError ($ exception );
72+ throw CouldNotSendNotification::pushbulletRespondedWithAnError ($ exception-> getResponse () );
7173 } catch (Exception $ exception ) {
7274 throw CouldNotSendNotification::couldNotCommunicateWithPushbullet ();
7375 }
0 commit comments