Skip to content

Commit

Permalink
make keyword nullable in InboundSMS.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK committed Oct 2, 2023
1 parent fc1e3a9 commit c92b7a1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/SMS/Webhook/InboundSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class InboundSMS
'messageId',
'text',
'type',
'keyword',
'message-timestamp'
];

Expand Down Expand Up @@ -60,7 +59,7 @@ class InboundSMS
protected $data;

/**
* @var string
* @var ?string
*/
protected $keyword;

Expand Down Expand Up @@ -126,7 +125,6 @@ public function __construct(array $data)
}

$this->apiKey = $data['api-key'] ?? null;
$this->keyword = $data['keyword'];
$this->messageId = $data['messageId'];
$this->messageTimestamp = new DateTimeImmutable($data['message-timestamp']);
$this->msisdn = $data['msisdn'];
Expand All @@ -148,6 +146,10 @@ public function __construct(array $data)
$this->udh = $data['udh'];
}

if (array_key_exists('keyword', $data)) {
$this->keyword = $data['keyword'];
}

if (array_key_exists('timestamp', $data)) {
$this->timestamp = (int)$data['timestamp'];
}
Expand Down Expand Up @@ -183,7 +185,7 @@ public function getData(): ?string
return $this->data;
}

public function getKeyword(): string
public function getKeyword(): ?string
{
return $this->keyword;
}
Expand Down

0 comments on commit c92b7a1

Please sign in to comment.