1 | <?php |
||
7 | class MessageEvent extends AbstractEvent |
||
8 | { |
||
9 | |||
10 | const NAME = 'message'; |
||
11 | |||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | protected $timestamp; |
||
16 | |||
17 | /** |
||
18 | * @var \Kerox\Messenger\Model\Callback\Message |
||
19 | */ |
||
20 | protected $message; |
||
21 | |||
22 | /** |
||
23 | * MessageEvent constructor. |
||
24 | * |
||
25 | * @param string $senderId |
||
26 | * @param string $recipientId |
||
27 | * @param int $timestamp |
||
28 | * @param \Kerox\Messenger\Model\Callback\Message $message |
||
29 | */ |
||
30 | 5 | public function __construct(string $senderId, string $recipientId, int $timestamp, Message $message) |
|
37 | |||
38 | /** |
||
39 | * @return int |
||
40 | */ |
||
41 | 1 | public function getTimestamp(): int |
|
45 | |||
46 | /** |
||
47 | * @return \Kerox\Messenger\Model\Callback\Message |
||
48 | */ |
||
49 | 1 | public function getMessage(): Message |
|
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 1 | public function getName(): string |
|
61 | |||
62 | /** |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function isQuickReply(): bool |
||
66 | { |
||
67 | return $this->message->hasQuickReply(); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param array $payload |
||
72 | * @return \Kerox\Messenger\Event\MessageEvent |
||
73 | */ |
||
74 | 4 | public static function create(array $payload): MessageEvent |
|
83 | } |
||
84 |