Skip to content

Commit 9ebd564

Browse files
authored
make keyword nullable in InboundSMS.php (#440)
1 parent fc1e3a9 commit 9ebd564

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/SMS/Webhook/InboundSMS.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class InboundSMS
2525
'messageId',
2626
'text',
2727
'type',
28-
'keyword',
2928
'message-timestamp'
3029
];
3130

@@ -60,7 +59,7 @@ class InboundSMS
6059
protected $data;
6160

6261
/**
63-
* @var string
62+
* @var ?string
6463
*/
6564
protected $keyword;
6665

@@ -126,7 +125,6 @@ public function __construct(array $data)
126125
}
127126

128127
$this->apiKey = $data['api-key'] ?? null;
129-
$this->keyword = $data['keyword'];
130128
$this->messageId = $data['messageId'];
131129
$this->messageTimestamp = new DateTimeImmutable($data['message-timestamp']);
132130
$this->msisdn = $data['msisdn'];
@@ -148,6 +146,10 @@ public function __construct(array $data)
148146
$this->udh = $data['udh'];
149147
}
150148

149+
if (array_key_exists('keyword', $data)) {
150+
$this->keyword = $data['keyword'];
151+
}
152+
151153
if (array_key_exists('timestamp', $data)) {
152154
$this->timestamp = (int)$data['timestamp'];
153155
}
@@ -183,7 +185,7 @@ public function getData(): ?string
183185
return $this->data;
184186
}
185187

186-
public function getKeyword(): string
188+
public function getKeyword(): ?string
187189
{
188190
return $this->keyword;
189191
}

0 commit comments

Comments
 (0)