1 | <?php |
||
5 | class PushoverReceiver |
||
6 | { |
||
7 | protected $key; |
||
8 | private $token; |
||
9 | protected $devices = []; |
||
10 | |||
11 | /** |
||
12 | * PushoverReceiver constructor. |
||
13 | * @param $key User or group key. |
||
14 | * @param $token App Token |
||
15 | */ |
||
16 | 12 | protected function __construct($key, $token = null) |
|
21 | |||
22 | /** |
||
23 | * Create new Pushover receiver with an user key. |
||
24 | * |
||
25 | * @param $userKey Pushover user key. |
||
26 | * @return PushoverReceiver |
||
27 | */ |
||
28 | 11 | public static function withUserKey($userKey) |
|
32 | |||
33 | /** |
||
34 | * Create new Pushover receiver with an app token and user key. |
||
35 | * |
||
36 | * @param string $token Pushover app token |
||
37 | * @param string $userKey Pushover user key. |
||
38 | * |
||
39 | * @return PushoverReceiver |
||
40 | */ |
||
41 | 2 | public static function withUserKeyAndToken($userKey, $token) |
|
45 | |||
46 | /** |
||
47 | * Create new Pushover receiver with a group key. |
||
48 | * |
||
49 | * @param $groupKey Pushover group key. |
||
50 | * @return PushoverReceiver |
||
51 | */ |
||
52 | 2 | public static function withGroupKey($groupKey) |
|
58 | |||
59 | /** |
||
60 | * Send the message to a specific device. |
||
61 | * |
||
62 | * @param array|string $device |
||
63 | * @return PushoverReceiver |
||
64 | */ |
||
65 | 6 | public function toDevice($device) |
|
76 | |||
77 | /** |
||
78 | * Get array representation of Pushover receiver. |
||
79 | * |
||
80 | * @return array |
||
81 | */ |
||
82 | 12 | public function toArray() |
|
95 | } |
||
96 |