| 1 | <?php |
||
| 5 | class PushoverReceiver |
||
|
|
|||
| 6 | { |
||
| 7 | protected $key; |
||
| 8 | protected $devices = []; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * PushoverReceiver constructor. |
||
| 12 | * @param $key User or group key. |
||
| 13 | */ |
||
| 14 | 9 | private function __construct($key) |
|
| 18 | |||
| 19 | /** |
||
| 20 | * Create new Pushover receiver with an user key. |
||
| 21 | * |
||
| 22 | * @param $userKey Pushover user key. |
||
| 23 | * @return PushoverReceiver |
||
| 24 | */ |
||
| 25 | 9 | public static function withUserKey($userKey) { |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Create new Pushover receiver with a group key. |
||
| 31 | * |
||
| 32 | * @param $groupKey Pushover group key. |
||
| 33 | * @return PushoverReceiver |
||
| 34 | */ |
||
| 35 | 1 | public static function withGroupKey($groupKey) { |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Send the message to a specific device. |
||
| 43 | * |
||
| 44 | * @param array|string $device |
||
| 45 | * @return PushoverReceiver |
||
| 46 | */ |
||
| 47 | 5 | public function toDevice($device) { |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Get array representation of Pushover receiver. |
||
| 60 | * |
||
| 61 | * @return array |
||
| 62 | */ |
||
| 63 | 9 | public function toArray() |
|
| 70 | |||
| 71 | } |