'delivered' => SmsEvent::DELIVERED,
'rejected' => SmsEvent::FAILED,
'submitted' => null,
'undeliverable' => SmsEvent::FAILED,
default =>
throw new RejectWebhookException(406,
sprintf('Unsupported event "%s".',
$payload['status'
])),
};
if (!
$name) { return null;
} $event =
new SmsEvent($name,
$payload['message_uuid'
],
$payload);
$event->
setRecipientPhone($payload['to'
]);
return $event;
} private function validateSignature(string
$jwt, string
$secret): void
{ $tokenParts =
explode('.',
$jwt);
if (3 !== \
count($tokenParts)) { throw new RejectWebhookException(406, 'Signature is wrong.'
);
} [