1 | <?php |
||
11 | class Pushover |
||
12 | { |
||
13 | /** |
||
14 | * Location of the Pushover API. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $pushoverApiUrl = 'https://api.pushover.net/1/messages.json'; |
||
19 | |||
20 | /** |
||
21 | * The HTTP client instance. |
||
22 | * |
||
23 | * @var \GuzzleHttp\Client |
||
24 | */ |
||
25 | protected $http; |
||
26 | |||
27 | /** |
||
28 | * Pushover App Token. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $token; |
||
33 | |||
34 | /** |
||
35 | * @param HttpClient $http |
||
36 | * @param string $token |
||
37 | */ |
||
38 | 10 | public function __construct(HttpClient $http, $token) |
|
44 | |||
45 | /** |
||
46 | * Send Pushover message. |
||
47 | * |
||
48 | * @link https://pushover.net/api |
||
49 | * |
||
50 | * @param array $params |
||
51 | * @return \Psr\Http\Message\ResponseInterface |
||
52 | * @throws CouldNotSendNotification |
||
53 | */ |
||
54 | 9 | public function send($params) |
|
69 | |||
70 | /** |
||
71 | * Merge token into parameters array, unless it has been set on the PushoverReceiver. |
||
72 | * |
||
73 | * @param array $params |
||
74 | * @return array |
||
75 | */ |
||
76 | 9 | protected function paramsWithToken($params) |
|
82 | } |
||
83 |