@@ 80-88 (lines=9) @@ | ||
77 | * |
|
78 | * @return MessageEvent |
|
79 | */ |
|
80 | public static function createMessageEvent(array $payload) |
|
81 | { |
|
82 | $message = Message::create($payload['message']); |
|
83 | $senderId = $payload['sender']['id']; |
|
84 | $recipientId = $payload['recipient']['id']; |
|
85 | $timestamp = $payload['timestamp']; |
|
86 | ||
87 | return new MessageEvent($senderId, $recipientId, $timestamp, $message); |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * @param array $payload |
|
@@ 95-103 (lines=9) @@ | ||
92 | * |
|
93 | * @return MessageEchoEvent |
|
94 | */ |
|
95 | public static function createMessageEchoEvent(array $payload) |
|
96 | { |
|
97 | $message = MessageEcho::create($payload['message']); |
|
98 | $senderId = $payload['sender']['id']; |
|
99 | $recipientId = $payload['recipient']['id']; |
|
100 | $timestamp = $payload['timestamp']; |
|
101 | ||
102 | return new MessageEchoEvent($senderId, $recipientId, $timestamp, $message); |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * @param array $payload |
|
@@ 110-118 (lines=9) @@ | ||
107 | * |
|
108 | * @return PostbackEvent |
|
109 | */ |
|
110 | public static function createPostbackEvent(array $payload) |
|
111 | { |
|
112 | $postback = Postback::create($payload['postback']); |
|
113 | $senderId = $payload['sender']['id']; |
|
114 | $recipientId = $payload['recipient']['id']; |
|
115 | $timestamp = $payload['timestamp']; |
|
116 | ||
117 | return new PostbackEvent($senderId, $recipientId, $timestamp, $postback); |
|
118 | } |
|
119 | ||
120 | /** |
|
121 | * @param array $payload |
|
@@ 125-133 (lines=9) @@ | ||
122 | * |
|
123 | * @return AuthenticationEvent |
|
124 | */ |
|
125 | public static function createAuthenticationEvent(array $payload) |
|
126 | { |
|
127 | $optin = Optin::create($payload['optin']); |
|
128 | $senderId = $payload['sender']['id']; |
|
129 | $recipientId = $payload['recipient']['id']; |
|
130 | $timestamp = $payload['timestamp']; |
|
131 | ||
132 | return new AuthenticationEvent($senderId, $recipientId, $timestamp, $optin); |
|
133 | } |
|
134 | ||
135 | /** |
|
136 | * @param array $payload |
|
@@ 140-148 (lines=9) @@ | ||
137 | * |
|
138 | * @return AccountLinkingEvent |
|
139 | */ |
|
140 | public static function createAccountLinkingEvent(array $payload) |
|
141 | { |
|
142 | $accountLinking = AccountLinking::create($payload['account_linking']); |
|
143 | $senderId = $payload['sender']['id']; |
|
144 | $recipientId = $payload['recipient']['id']; |
|
145 | $timestamp = $payload['timestamp']; |
|
146 | ||
147 | return new AccountLinkingEvent($senderId, $recipientId, $timestamp, $accountLinking); |
|
148 | } |
|
149 | ||
150 | /** |
|
151 | * @param array $payload |
|
@@ 169-177 (lines=9) @@ | ||
166 | * |
|
167 | * @return MessageReadEvent |
|
168 | */ |
|
169 | public static function createMessageReadEvent(array $payload) |
|
170 | { |
|
171 | $read = Read::create($payload['read']); |
|
172 | $senderId = $payload['sender']['id']; |
|
173 | $recipientId = $payload['recipient']['id']; |
|
174 | $timestamp = $payload['timestamp']; |
|
175 | ||
176 | return new MessageReadEvent($senderId, $recipientId, $timestamp, $read); |
|
177 | } |
|
178 | ||
179 | /** |
|
180 | * @param array $payload |
|
@@ 184-192 (lines=9) @@ | ||
181 | * |
|
182 | * @return ReferralEvent |
|
183 | */ |
|
184 | public static function createReferralEvent(array $payload) |
|
185 | { |
|
186 | $referral = Referral::create($payload['referral']); |
|
187 | $senderId = $payload['sender']['id']; |
|
188 | $recipientId = $payload['recipient']['id']; |
|
189 | $timestamp = $payload['timestamp']; |
|
190 | ||
191 | return new ReferralEvent($senderId, $recipientId, $timestamp, $referral); |
|
192 | } |
|
193 | } |
|
194 |