|
@@ 74-82 (lines=9) @@
|
| 71 |
|
* |
| 72 |
|
* @return MessageEvent |
| 73 |
|
*/ |
| 74 |
|
public static function createMessageEvent(array $payload) |
| 75 |
|
{ |
| 76 |
|
$message = Message::create($payload['message']); |
| 77 |
|
$senderId = $payload['sender']['id']; |
| 78 |
|
$recipientId = $payload['recipient']['id']; |
| 79 |
|
$timestamp = $payload['timestamp']; |
| 80 |
|
|
| 81 |
|
return new MessageEvent($senderId, $recipientId, $timestamp, $message); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
/** |
| 85 |
|
* @param array $payload |
|
@@ 89-97 (lines=9) @@
|
| 86 |
|
* |
| 87 |
|
* @return MessageEchoEvent |
| 88 |
|
*/ |
| 89 |
|
public static function createMessageEchoEvent(array $payload) |
| 90 |
|
{ |
| 91 |
|
$message = MessageEcho::create($payload['message']); |
| 92 |
|
$senderId = $payload['sender']['id']; |
| 93 |
|
$recipientId = $payload['recipient']['id']; |
| 94 |
|
$timestamp = $payload['timestamp']; |
| 95 |
|
|
| 96 |
|
return new MessageEchoEvent($senderId, $recipientId, $timestamp, $message); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
/** |
| 100 |
|
* @param array $payload |
|
@@ 104-112 (lines=9) @@
|
| 101 |
|
* |
| 102 |
|
* @return PostbackEvent |
| 103 |
|
*/ |
| 104 |
|
public static function createPostbackEvent(array $payload) |
| 105 |
|
{ |
| 106 |
|
$postback = Postback::create($payload['postback']); |
| 107 |
|
$senderId = $payload['sender']['id']; |
| 108 |
|
$recipientId = $payload['recipient']['id']; |
| 109 |
|
$timestamp = $payload['timestamp']; |
| 110 |
|
|
| 111 |
|
return new PostbackEvent($senderId, $recipientId, $timestamp, $postback); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
/** |
| 115 |
|
* @param array $payload |
|
@@ 119-127 (lines=9) @@
|
| 116 |
|
* |
| 117 |
|
* @return AuthenticationEvent |
| 118 |
|
*/ |
| 119 |
|
public static function createAuthenticationEvent(array $payload) |
| 120 |
|
{ |
| 121 |
|
$optin = Optin::create($payload['optin']); |
| 122 |
|
$senderId = $payload['sender']['id']; |
| 123 |
|
$recipientId = $payload['recipient']['id']; |
| 124 |
|
$timestamp = $payload['timestamp']; |
| 125 |
|
|
| 126 |
|
return new AuthenticationEvent($senderId, $recipientId, $timestamp, $optin); |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
/** |
| 130 |
|
* @param array $payload |
|
@@ 134-142 (lines=9) @@
|
| 131 |
|
* |
| 132 |
|
* @return AccountLinkingEvent |
| 133 |
|
*/ |
| 134 |
|
public static function createAccountLinkingEvent(array $payload) |
| 135 |
|
{ |
| 136 |
|
$accountLinking = AccountLinking::create($payload['account_linking']); |
| 137 |
|
$senderId = $payload['sender']['id']; |
| 138 |
|
$recipientId = $payload['recipient']['id']; |
| 139 |
|
$timestamp = $payload['timestamp']; |
| 140 |
|
|
| 141 |
|
return new AccountLinkingEvent($senderId, $recipientId, $timestamp, $accountLinking); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
/** |
| 145 |
|
* @param array $payload |
|
@@ 163-171 (lines=9) @@
|
| 160 |
|
* |
| 161 |
|
* @return MessageReadEvent |
| 162 |
|
*/ |
| 163 |
|
public static function createMessageReadEvent(array $payload) |
| 164 |
|
{ |
| 165 |
|
$read = Read::create($payload['read']); |
| 166 |
|
$senderId = $payload['sender']['id']; |
| 167 |
|
$recipientId = $payload['recipient']['id']; |
| 168 |
|
$timestamp = $payload['timestamp']; |
| 169 |
|
|
| 170 |
|
return new MessageReadEvent($senderId, $recipientId, $timestamp, $read); |
| 171 |
|
} |
| 172 |
|
} |
| 173 |
|
|