1 | <?php |
||
7 | class PushbulletMessage |
||
8 | { |
||
9 | const TYPE_NOTE = 'note'; |
||
10 | const TYPE_LINK = 'link'; |
||
11 | |||
12 | /** |
||
13 | * Type of message (currently: note or link). |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | public $type = 'note'; |
||
18 | |||
19 | /** @var \NotificationChannels\Pushbullet\Targets\Targetable */ |
||
20 | protected $target; |
||
21 | |||
22 | /** |
||
23 | * Notification title. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | public $title; |
||
28 | |||
29 | /** |
||
30 | * Notification message. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | public $message; |
||
35 | |||
36 | /** |
||
37 | * Url if notification is of link type. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | public $url; |
||
42 | |||
43 | /** |
||
44 | * @param string $message |
||
45 | * |
||
46 | * @return static |
||
47 | */ |
||
48 | public static function create($message) |
||
52 | |||
53 | /** |
||
54 | * @param string $message |
||
55 | */ |
||
56 | 7 | public function __construct($message) |
|
60 | |||
61 | /** |
||
62 | * @param \NotificationChannels\Pushbullet\Targets\Targetable $targetable |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function target(Targetable $targetable) |
||
72 | |||
73 | /** |
||
74 | * Specify that notification is of `note` type. |
||
75 | * |
||
76 | * @return $this |
||
77 | */ |
||
78 | 1 | public function note() |
|
84 | |||
85 | /** |
||
86 | * Specify that notification is of `link` type. |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | 2 | public function link() |
|
96 | |||
97 | /** |
||
98 | * Set notification title. |
||
99 | * |
||
100 | * @param string $title |
||
101 | * |
||
102 | * @return $this |
||
103 | */ |
||
104 | 1 | public function title($title) |
|
110 | |||
111 | /** |
||
112 | * Set notification message. |
||
113 | * |
||
114 | * @param string $message |
||
115 | * |
||
116 | * @return $this |
||
117 | */ |
||
118 | 1 | public function message($message) |
|
124 | |||
125 | /** |
||
126 | * Set notification url (if notification is of `link` type). |
||
127 | * |
||
128 | * @param string $url |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | 1 | public function url($url) |
|
138 | |||
139 | /** |
||
140 | * Get array representation of message for Pushbullet client. |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | public function toArray() |
||
159 | } |
||
160 |