1 | <?php |
||
13 | class FacebookMessage implements \JsonSerializable |
||
14 | { |
||
15 | use HasButtons; |
||
16 | |||
17 | /** @var string Recipient's ID. */ |
||
18 | public $recipient; |
||
19 | |||
20 | /** @var string Sender's Page Token. */ |
||
21 | public $sender; |
||
22 | |||
23 | /** @var string Notification Text. */ |
||
24 | public $text; |
||
25 | |||
26 | /** @var string Notification Type */ |
||
27 | public $notificationType = NotificationType::REGULAR; |
||
28 | |||
29 | /** @var array Generic Template Cards (items) */ |
||
30 | public $cards = []; |
||
31 | |||
32 | /** @var string Attachment Type. Defaults to File */ |
||
33 | public $attachmentType = AttachmentType::FILE; |
||
34 | |||
35 | /** @var string Attachment URL */ |
||
36 | public $attachmentUrl; |
||
37 | |||
38 | /** @var bool */ |
||
39 | protected $hasAttachment = false; |
||
40 | |||
41 | /** @var bool */ |
||
42 | protected $hasText = false; |
||
43 | |||
44 | /** |
||
45 | * @param string $text |
||
46 | * |
||
47 | * @return static |
||
48 | */ |
||
49 | public static function create($text = '') |
||
53 | |||
54 | /** |
||
55 | * @param string $text |
||
56 | */ |
||
57 | public function __construct($text = '') |
||
63 | |||
64 | /** |
||
65 | * Recipient's PSID or Phone Number. |
||
66 | * |
||
67 | * The id must be an ID that was retrieved through the |
||
68 | * Messenger entry points or through the Messenger webhooks. |
||
69 | * |
||
70 | * @param $recipient ID of recipient or Phone number of the recipient |
||
71 | * with the format +1(212)555-2368 |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function to($recipient) |
||
81 | |||
82 | /** |
||
83 | * Sender's facebook page token. |
||
84 | * |
||
85 | * @param $recipient page token of the sender |
||
86 | * |
||
87 | * @return $this |
||
88 | */ |
||
89 | public function from($sender) |
||
95 | |||
96 | /** |
||
97 | * Notification text. |
||
98 | * |
||
99 | * @param $text |
||
100 | * |
||
101 | * @throws CouldNotCreateMessage |
||
102 | * |
||
103 | * @return $this |
||
104 | */ |
||
105 | public function text($text) |
||
116 | |||
117 | /** |
||
118 | * Add Attachment. |
||
119 | * |
||
120 | * @param $attachmentType |
||
121 | * @param $url |
||
122 | * |
||
123 | * @throws CouldNotCreateMessage |
||
124 | * |
||
125 | * @return $this |
||
126 | */ |
||
127 | public function attach($attachmentType, $url) |
||
150 | |||
151 | /** |
||
152 | * Push notification type. |
||
153 | * |
||
154 | * @param string $notificationType Possible values: REGULAR, SILENT_PUSH, NO_PUSH |
||
155 | * |
||
156 | * @return $this |
||
157 | */ |
||
158 | public function notificationType($notificationType) |
||
164 | |||
165 | /** |
||
166 | * Add up to 10 cards to be displayed in a carousel. |
||
167 | * |
||
168 | * @param array $cards |
||
169 | * |
||
170 | * @return $this |
||
171 | * @throws CouldNotCreateMessage |
||
172 | */ |
||
173 | public function cards(array $cards = []) |
||
183 | |||
184 | /** |
||
185 | * Determine if user id is not given. |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | public function toNotGiven() |
||
193 | |||
194 | /** |
||
195 | * Determine if a custom sender is given. |
||
196 | * |
||
197 | * @return bool |
||
198 | */ |
||
199 | public function senderGiven() |
||
203 | |||
204 | /** |
||
205 | * Convert the object into something JSON serializable. |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | public function jsonSerialize() |
||
213 | |||
214 | /** |
||
215 | * Returns message payload for JSON conversion. |
||
216 | * |
||
217 | * @throws CouldNotCreateMessage |
||
218 | * @return array |
||
219 | */ |
||
220 | public function toArray() |
||
241 | |||
242 | /** |
||
243 | * Returns message for simple text message. |
||
244 | * |
||
245 | * @return array |
||
246 | */ |
||
247 | protected function textMessageToArray() |
||
256 | |||
257 | /** |
||
258 | * Returns message for attachment message. |
||
259 | * |
||
260 | * @return array |
||
261 | */ |
||
262 | protected function attachmentMessageToArray() |
||
272 | |||
273 | /** |
||
274 | * Returns message for Generic Template message. |
||
275 | * |
||
276 | * @return array |
||
277 | */ |
||
278 | protected function genericMessageToArray() |
||
289 | |||
290 | /** |
||
291 | * Returns message for Button Template message. |
||
292 | * |
||
293 | * @return array |
||
294 | */ |
||
295 | protected function buttonMessageToArray() |
||
307 | } |
||
308 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..