1 | <?php |
||
6 | class QuickReply implements \JsonSerializable |
||
7 | { |
||
8 | use ValidatorTrait; |
||
9 | |||
10 | const CONTENT_TYPE_TEXT = 'text'; |
||
11 | const CONTENT_TYPE_LOCATION = 'location'; |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $contentType; |
||
17 | |||
18 | /** |
||
19 | * @var null|string |
||
20 | */ |
||
21 | protected $title; |
||
22 | |||
23 | /** |
||
24 | * @var null|string |
||
25 | */ |
||
26 | protected $payload; |
||
27 | |||
28 | /** |
||
29 | * @var null|string |
||
30 | */ |
||
31 | protected $imageUrl; |
||
32 | |||
33 | /** |
||
34 | * QuickReply constructor. |
||
35 | * |
||
36 | * @param string $contentType |
||
37 | * @throws \Exception |
||
38 | */ |
||
39 | public function __construct(string $contentType) |
||
47 | |||
48 | /** |
||
49 | * @param string $title |
||
50 | * @return \Kerox\Messenger\Model\Message\QuickReply |
||
51 | */ |
||
52 | public function setTitle(string $title): QuickReply |
||
60 | |||
61 | /** |
||
62 | * @param mixed $payload |
||
63 | * @return \Kerox\Messenger\Model\Message\QuickReply |
||
64 | */ |
||
65 | public function setPayload(string $payload): QuickReply |
||
73 | |||
74 | /** |
||
75 | * @param mixed $imageUrl |
||
76 | * @return \Kerox\Messenger\Model\Message\QuickReply |
||
77 | */ |
||
78 | public function setImageUrl(string $imageUrl): QuickReply |
||
86 | |||
87 | /** |
||
88 | * @return array |
||
89 | */ |
||
90 | private function getAllowedContentType(): array |
||
97 | |||
98 | /** |
||
99 | * @return void |
||
100 | * @throws \Exception |
||
101 | */ |
||
102 | private function checkContentType() |
||
108 | |||
109 | /** |
||
110 | * @return array |
||
111 | */ |
||
112 | public function jsonSerialize(): array |
||
123 | } |
||
124 |