1 | <?php |
||
5 | class PushoverReceiver |
||
6 | { |
||
7 | protected $key; |
||
8 | protected $token; |
||
9 | protected $devices = []; |
||
10 | |||
11 | /** |
||
12 | * PushoverReceiver constructor. |
||
13 | * @param $key User or group key. |
||
14 | */ |
||
15 | 12 | protected function __construct($key) |
|
19 | |||
20 | /** |
||
21 | * Create new Pushover receiver with an user key. |
||
22 | * |
||
23 | * @param $userKey Pushover user key. |
||
24 | * @return PushoverReceiver |
||
25 | */ |
||
26 | 12 | public static function withUserKey($userKey) |
|
30 | |||
31 | /** |
||
32 | * Create new Pushover receiver with a group key. |
||
33 | * |
||
34 | * @param $groupKey Pushover group key. |
||
35 | * @return PushoverReceiver |
||
36 | */ |
||
37 | 2 | public static function withGroupKey($groupKey) |
|
43 | |||
44 | /** |
||
45 | * Send the message to a specific device. |
||
46 | * |
||
47 | * @param array|string $device |
||
48 | * @return PushoverReceiver |
||
49 | */ |
||
50 | 6 | public function toDevice($device) |
|
61 | |||
62 | /** |
||
63 | * Set the application token. |
||
64 | * |
||
65 | * @param $token |
||
66 | * @return PushoverReceiver |
||
67 | */ |
||
68 | 2 | public function withApplicationToken($token) |
|
74 | |||
75 | /** |
||
76 | * Get array representation of Pushover receiver. |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | 12 | public function toArray() |
|
87 | } |
||
88 |