One Hat Cyber Team
Your IP:
216.73.216.102
Server IP:
198.54.114.155
Server:
Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
5.6.40
Create File
|
Create Folder
Execute
Dir :
~
/
home
/
fluxyjvi
/
www
/
assets
/
images
/
Edit File:
SMS.tar
ClientFactory.php 0000644 00000001763 15107375375 0010047 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS; use Psr\Container\ContainerInterface; use Vonage\Client\APIResource; use Vonage\Client\Credentials\Handler\BasicHandler; use Vonage\Client\Credentials\Handler\SignatureBodyHandler; class ClientFactory { public function __invoke(ContainerInterface $container): Client { /** @var APIResource $api */ $api = $container->make(APIResource::class); $api ->setBaseUrl($api->getClient()->getRestUrl()) ->setCollectionName('messages') ->setIsHAL(false) ->setErrorsOn200(true) ->setExceptionErrorHandler(new ExceptionErrorHandler()) ->setAuthHandler([new BasicHandler(), new SignatureBodyHandler()]); return new Client($api); } } Client.php 0000644 00000004052 15107375375 0006511 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS; use Psr\Http\Client\ClientExceptionInterface; use Psr\Log\LogLevel; use Vonage\Client\APIClient; use Vonage\Client\APIResource; use Vonage\Client\Exception\Exception as ClientException; use Vonage\Client\Exception\ThrottleException; use Vonage\Logger\LoggerTrait; use Vonage\SMS\Message\Message; use function sleep; class Client implements APIClient { use LoggerTrait; public function __construct(protected APIResource $api) { } public function getAPIResource(): APIResource { return $this->api; } /** * @throws ClientExceptionInterface * @throws ClientException */ public function send(Message $message): Collection { if ($warningMessage = $message->getWarningMessage()) { $this->log(LogLevel::WARNING, $warningMessage); } try { $response = $this->api->create($message->toArray(), '/sms/json'); return new Collection($response); } catch (ThrottleException $e) { sleep($e->getTimeout()); return $this->send($message); } } /** * @throws ClientExceptionInterface * @throws ClientException */ public function sendTwoFactor(string $number, int $pin): SentSMS { $response = $this->api->create( ['to' => $number, 'pin' => $pin], '/sc/us/2fa/json' ); return new SentSMS($response['messages'][0]); } /** * @throws ClientExceptionInterface * @throws ClientException */ public function sendAlert(string $number, array $templateReplacements): Collection { $response = $this->api->create( ['to' => $number] + $templateReplacements, '/sc/us/alert/json' ); return new Collection($response); } } ExceptionErrorHandler.php 0000644 00000005242 15107375376 0011544 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Vonage\Client\Exception as ClientException; use Vonage\Client\Exception\ThrottleException; use function json_decode; use function preg_match; class ExceptionErrorHandler { /** * @throws ClientException\Request * @throws ClientException\Server * @throws ThrottleException */ public function __invoke(ResponseInterface $response, RequestInterface $request) { //check for valid data, as well as an error response from the API if ((int)$response->getStatusCode() === 429) { throw new ThrottleException('Too many concurrent requests', $response->getStatusCode()); } $data = json_decode($response->getBody()->getContents(), true); if (!isset($data['messages'])) { if (isset($data['error-code'], $data['error-code-label'])) { $e = new ClientException\Request($data['error-code-label'], (int)$data['error-code']); } elseif (isset($data['title'], $data['detail'])) { $e = new ClientException\Request($data['title'] . ' : ' . $data['detail']); } else { $e = new ClientException\Request('Unexpected response from the API'); } $e->setEntity($data); throw $e; } //normalize errors (client vrs server) foreach ($data['messages'] as $part) { switch ($part['status']) { case '0': break; //all okay case '1': $e = new ThrottleException($part['error-text']); $e->setTimeout(1); $e->setEntity($data); if (preg_match('#Throughput Rate Exceeded - please wait \[\s+(\d+)\s+] and retry#', $part['error-text'], $match)) { $seconds = max((int)$match[1] / 1000, 1); $e->setTimeout($seconds); } throw $e; case '5': $e = new ClientException\Server($part['error-text'], (int)$part['status']); $e->setEntity($data); throw $e; default: $e = new ClientException\Request($part['error-text'], (int)$part['status']); $e->setEntity($data); throw $e; } } } } Collection.php 0000644 00000002377 15107375376 0007377 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS; use Countable; use Iterator; class Collection implements Countable, Iterator { /** * @var int */ protected $current = 0; /** * @param array<string, int|array<string, mixed>> $data */ public function __construct(protected array $data) { } public function count(): int { return (int)$this->data['message-count']; } public function current(): SentSMS { return new SentSMS($this->data['messages'][$this->current]); } /** * @return bool|float|int|string|null */ #[\ReturnTypeWillChange] public function key() { return $this->current; } public function next(): void { $this->current++; } public function rewind(): void { $this->current = 0; } public function valid(): bool { return isset($this->data['messages'][$this->current]); } public function getAllMessagesRaw(): array { return $this->data; } } SentSMS.php 0000644 00000003637 15107375376 0006600 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS; class SentSMS { /** * @var ?string */ protected $accountRef; /** * @var ?string */ protected $clientRef; /** * @var string */ protected $messageId; /** * @var string */ protected $messagePrice; /** * @var string */ protected $network; /** * @var string */ protected $remainingBalance; /** * @var int */ protected $status; /** * @var string */ protected $to; public function __construct(array $data) { $this->accountRef = $data['account-ref'] ?? null; $this->clientRef = $data['client-ref'] ?? null; $this->to = $data['to']; $this->messageId = $data['message-id']; $this->status = (int)$data['status']; $this->remainingBalance = $data['remaining-balance']; $this->messagePrice = $data['message-price']; $this->network = $data['network']; } public function getAccountRef(): ?string { return $this->accountRef; } public function getClientRef(): ?string { return $this->clientRef; } public function getMessageId(): string { return $this->messageId; } public function getMessagePrice(): string { return $this->messagePrice; } public function getNetwork(): string { return $this->network; } public function getRemainingBalance(): string { return $this->remainingBalance; } public function getStatus(): int { return $this->status; } public function getTo(): string { return $this->to; } } Webhook/InboundSMS.php 0000644 00000011240 15107375376 0010650 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Webhook; use DateTimeImmutable; use Exception; use InvalidArgumentException; use function array_key_exists; class InboundSMS { public static $requiredFields = [ 'msisdn', 'to', 'messageId', 'text', 'type', 'keyword', 'message-timestamp' ]; /** * @var string */ protected $apiKey; /** * @var bool */ protected $concat = false; /** * @var ?int */ protected $concatPart; /** * @var ?string */ protected $concatRef; /** * @var ?int */ protected $concatTotal; /** * @var ?string */ protected $data; /** * @var string */ protected $keyword; /** * @var string */ protected $messageId; /** * @var DateTimeImmutable */ protected $messageTimestamp; /** * @var string */ protected $msisdn; /** * @var ?string */ protected $nonce; /** * @var string */ protected $signature; /** * @var string */ protected $text; /** * @var ?int */ protected $timestamp; /** * @var string */ protected $to; /** * @var string */ protected $type; /** * @var ?string */ protected $udh; /** * @throws Exception */ public function __construct(array $data) { foreach (static::$requiredFields as $key) { if (!array_key_exists($key, $data)) { throw new InvalidArgumentException('Incoming SMS missing required data `' . $key . '`'); } } $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']; $this->nonce = $data['nonce'] ?? null; $this->signature = $data['sig'] ?? null; $this->text = $data['text']; $this->to = $data['to']; $this->type = $data['type']; if (array_key_exists('concat', $data)) { $this->concat = true; $this->concatPart = (int)$data['concat-part']; $this->concatRef = $data['concat-ref']; $this->concatTotal = (int)$data['concat-total']; } if ($this->type === 'binary' && array_key_exists('data', $data)) { $this->data = $data['data']; $this->udh = $data['udh']; } if (array_key_exists('timestamp', $data)) { $this->timestamp = (int)$data['timestamp']; } } public function getApiKey(): ?string { return $this->apiKey; } public function getConcat(): bool { return $this->concat; } public function getConcatPart(): ?int { return $this->concatPart; } public function getConcatRef(): ?string { return $this->concatRef; } public function getConcatTotal(): ?int { return $this->concatTotal; } public function getData(): ?string { return $this->data; } public function getKeyword(): string { return $this->keyword; } public function getMessageId(): string { return $this->messageId; } /** * Time the message was accepted and delivery receipt was generated */ public function getMessageTimestamp(): DateTimeImmutable { return $this->messageTimestamp; } public function getMsisdn(): string { return $this->msisdn; } public function getFrom(): string { return $this->msisdn; } public function getNonce(): string { return $this->nonce; } public function getText(): string { return $this->text; } /** * Return the timestamp used for signature verification * If you are looking for the time of message creation, please use * `getMessageTimestamp()` */ public function getTimestamp(): ?int { return $this->timestamp; } public function getTo(): string { return $this->to; } public function getType(): string { return $this->type; } public function getUdh(): ?string { return $this->udh; } public function getSignature(): string { return $this->signature; } } Webhook/DeliveryReceipt.php 0000644 00000014735 15107375376 0012002 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Webhook; use DateTimeImmutable; use Exception; use InvalidArgumentException; use function array_key_exists; use function filter_var; class DeliveryReceipt { /** * Message was delivered successfully */ public const CODE_DELIVERED = 0; /** * Message was not delivered, and no reason could be determined */ public const CODE_UNKNOWN = 1; /** * Message was not delivered because handset was temporarily unavailable - retry */ public const CODE_ABSENT_TEMPORARY = 2; /** * The number is no longer active and should be removed from your database */ public const CODE_ABSENT_PERMANENT = 3; /** * This is a permanent error. * The number should be removed from your database and the user must * contact their network operator to remove the bar */ public const CODE_BARRED = 4; /** * There is an issue relating to portability of the number and you should contact the network operator to resolve it */ public const CODE_PORTABILITY_ERROR = 5; /** * The message has been blocked by a carrier's anti-spam filter */ public const CODE_SPAM_REJECTION = 6; /** * The handset was not available at the time the message was sent - retry */ public const CODE_HANDSET_BUSY = 7; /** * The message failed due to a network error - retry */ public const CODE_NETWORK_ERROR = 8; /** * The user has specifically requested not to receive messages from a specific service */ public const CODE_ILLEGAL_NUMBER = 9; /** * There is an error in a message parameter, e.g. wrong encoding flag */ public const CODE_ILLEGAL_MESSAGE = 10; /** * Vonage cannot find a suitable route to deliver the message * Contact support@Vonage.com */ public const CODE_UNROUTABLE = 11; /** * A route to the number cannot be found - confirm the recipient's number */ public const CODE_UNREACHABLE = 12; /** * The target cannot receive your message due to their age */ public const CODE_AGE_RESTRICTION = 13; /** * The recipient should ask their carrier to enable SMS on their plan */ public const CODE_CARRIER_BLOCK = 14; /** * The recipient is on a prepaid plan and does not have enough credit to receive your message */ public const CODE_INSUFFICIENT_FUNDS = 15; /** * Typically refers to an error in the route * Contact support@Vonage.com */ public const CODE_GENERAL_ERROR = 99; /** * Message has been accepted for delivery, but has not yet been delivered */ public const STATUS_ACCEPTED = 'accepted'; /** * Message has been delivered */ public const STATUS_DELIVERED = 'delivered'; /** * Message has been buffered for later delivery */ public const STATUS_BUFFERED = 'buffered'; /** * Message was held at downstream carrier's retry scheme and could not be delivered within the expiry time */ public const STATUS_EXPIRED = 'expired'; /** * Message not delivered */ public const STATUS_FAILED = 'failed'; /** * Downstream carrier refuses to deliver message */ public const STATUS_REJECTED = 'rejected'; /** * No useful information available */ public const STATUS_UNKNOWN = 'unknown'; public static $requiredFields = [ 'err-code', 'message-timestamp', 'messageId', 'msisdn', 'price', 'status', 'to' ]; /** * @var int */ protected $errCode; /** * @var DateTimeImmutable */ protected $messageTimestamp; /** * @var string */ protected $messageId; /** * @var string */ protected $msisdn; /** * @var string */ protected $networkCode; /** * @var string */ protected $price; /** * @var string */ protected $scts; /** * @var string */ protected $status; /** * @var string */ protected $to; /** * @var string */ protected $apiKey; /** * @var mixed|string */ protected $clientRef; /** * @param array<string, string> $data * * @throws Exception */ public function __construct(array $data) { foreach (static::$requiredFields as $key) { if (!array_key_exists($key, $data)) { throw new InvalidArgumentException('Delivery Receipt missing required data `' . $key . '`'); } } $this->errCode = filter_var($data['err-code'], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); $this->messageTimestamp = new DateTimeImmutable($data['message-timestamp']); $this->messageId = $data['messageId']; $this->msisdn = $data['msisdn']; $this->price = $data['price']; $this->status = $data['status']; $this->to = $data['to']; $this->apiKey = $data['api-key']; if (isset($data['network-code'])) { $this->networkCode = $data['network-code']; } if (isset($data['client-ref'])) { $this->clientRef = $data['client-ref']; } if (isset($data['scts'])) { $this->scts = $data['scts']; } } public function getErrCode(): int { return $this->errCode; } public function getMessageTimestamp(): DateTimeImmutable { return $this->messageTimestamp; } public function getMessageId(): string { return $this->messageId; } public function getMsisdn(): string { return $this->msisdn; } public function getNetworkCode(): string { return $this->networkCode; } public function getPrice(): string { return $this->price; } public function getScts(): ?string { return $this->scts; } public function getStatus(): string { return $this->status; } public function getTo(): string { return $this->to; } public function getApiKey(): string { return $this->apiKey; } public function getClientRef(): ?string { return $this->clientRef ?? null; } } Webhook/Factory.php 0000644 00000002403 15107375376 0010277 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Webhook; use Exception; use InvalidArgumentException; use Vonage\Webhook\Factory as WebhookFactory; use function array_intersect; use function array_key_exists; use function array_keys; use function count; class Factory extends WebhookFactory { /** * @throws Exception * * @return mixed|DeliveryReceipt|InboundSMS */ public static function createFromArray(array $data) { // We are dealing with only two webhooks here. One has the text field, one does not. // A sort of if/else style block here smells a bit, ideally the backend needs to change. if (!array_key_exists('text', $data)) { return new DeliveryReceipt($data); } if ( count(array_intersect(array_keys($data), InboundSMS::$requiredFields)) === count(InboundSMS::$requiredFields) ) { return new InboundSMS($data); } throw new InvalidArgumentException("Unable to determine incoming webhook type"); } } Message/SMS.php 0000644 00000005231 15107375377 0007323 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Message; class SMS extends OutboundMessage { public const GSM_7_CHARSET = "\n\f\r !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~ ¡£¤¥§¿ÄÅÆÇÉÑÖØÜßàäåæèéìñòöøùüΓΔΘΛΞΠΣΦΨΩ€"; protected ?string $contentId; protected ?string $entityId; /** * @var string */ protected string $type = 'text'; public function __construct(string $to, string $from, protected string $message, string $type = 'text') { parent::__construct($to, $from); $this->setType($type); } public static function isGsm7(string $message): bool { $fullPattern = "/\A[" . preg_quote(self::GSM_7_CHARSET, '/') . "]*\z/u"; return (bool)preg_match($fullPattern, $message); } public function getContentId(): string { return $this->contentId; } public function getEntityId(): string { return $this->entityId; } public function setContentId(string $id): self { $this->contentId = $id; return $this; } public function setEntityId(string $id): self { $this->entityId = $id; return $this; } public function getWarningMessage(): ?string { if ($this->getType() === 'text' && ! self::isGsm7($this->getMessage())) { $this->setWarningMessage("You are sending a message as `text` which contains non-GSM7 characters. This could result in encoding problems with the target device - See https://developer.vonage.com/messaging/sms for details, or email support@vonage.com if you have any questions."); } return $this->warningMessage; } /** * @return array<mixed> */ public function toArray(): array { $data = ['text' => $this->getMessage()]; if (!empty($this->entityId)) { $data['entity-id'] = $this->entityId; } if (!empty($this->contentId)) { $data['content-id'] = $this->contentId; } $data = $this->appendUniversalOptions($data); return $data; } public function getMessage(): string { return $this->message; } public function enableDLT(string $entityId, string $templateId): self { $this->entityId = $entityId; $this->contentId = $templateId; return $this; } } Message/Message.php 0000644 00000000773 15107375377 0010253 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Message; interface Message { public function toArray(): array; public function getErrorMessage(): ?string; public function getWarningMessage(): ?string; public function setWarningMessage(?string $errorMessage): void; } Message/OutboundMessage.php 0000644 00000012147 15107375377 0011771 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Message; use InvalidArgumentException; use function array_merge; use function is_null; use function strlen; abstract class OutboundMessage implements Message { protected ?string $accountRef = null; protected ?string $clientRef = null; protected ?string $deliveryReceiptCallback = null; protected ?int $messageClass = null; protected bool $requestDeliveryReceipt = true; /** * TTL of the SMS delivery, in milliseconds * * @var int */ protected $ttl = 259200000; protected ?string $warningMessage = null; /** * Type of message, set by the child class * * @var string */ protected string $type; public function __construct(protected string $to, protected string $from) { } /** * @deprecated Shim when correcting naming conventions, will be removed when it comes out the interface */ public function getErrorMessage(): ?string { return $this->getWarningMessage(); } public function getWarningMessage(): ?string { return $this->warningMessage; } public function setWarningMessage(?string $errorMessage): void { $this->warningMessage = $errorMessage; } abstract public function toArray(): array; public function getTtl(): int { return $this->ttl; } /** * @return $this */ public function setTtl(int $ttl): self { if ($ttl < 20000 || $ttl > 604800000) { throw new InvalidArgumentException('SMS TTL must be in the range of 20000-604800000 milliseconds'); } $this->ttl = $ttl; return $this; } public function getRequestDeliveryReceipt(): bool { return $this->requestDeliveryReceipt; } /** * @return $this */ public function setRequestDeliveryReceipt(bool $requestDeliveryReceipt): self { $this->requestDeliveryReceipt = $requestDeliveryReceipt; return $this; } public function getDeliveryReceiptCallback(): ?string { return $this->deliveryReceiptCallback; } /** * @return $this */ public function setDeliveryReceiptCallback(string $deliveryReceiptCallback): self { $this->deliveryReceiptCallback = $deliveryReceiptCallback; $this->setRequestDeliveryReceipt(true); return $this; } public function getMessageClass(): int { return $this->messageClass; } /** * @return $this */ public function setMessageClass(int $messageClass): self { if ($messageClass < 0 || $messageClass > 3) { throw new InvalidArgumentException('Message Class must be 0-3'); } $this->messageClass = $messageClass; return $this; } public function getClientRef(): string { return $this->clientRef; } /** * @return $this */ public function setClientRef(string $clientRef): self { if (strlen($clientRef) > 40) { throw new InvalidArgumentException('Client Ref can be no more than 40 characters'); } $this->clientRef = $clientRef; return $this; } /** * This adds any additional options to an individual SMS request * This allows the child classes to set their special request options, * and then filter through here for additional request options; */ protected function appendUniversalOptions(array $data): array { $data = array_merge($data, [ 'to' => $this->getTo(), 'from' => $this->getFrom(), 'type' => $this->getType(), 'ttl' => $this->getTtl(), 'status-report-req' => (int)$this->getRequestDeliveryReceipt(), ]); if ($this->getRequestDeliveryReceipt() && !is_null($this->getDeliveryReceiptCallback())) { $data['callback'] = $this->getDeliveryReceiptCallback(); } if (!is_null($this->messageClass)) { $data['message-class'] = $this->getMessageClass(); } if ($this->accountRef) { $data['account-ref'] = $this->getAccountRef(); } if ($this->clientRef) { $data['client-ref'] = $this->getClientRef(); } return $data; } public function getFrom(): string { return $this->from; } public function getTo(): string { return $this->to; } public function getAccountRef(): ?string { return $this->accountRef; } /** * @return $this */ public function setAccountRef(string $accountRef): OutboundMessage { $this->accountRef = $accountRef; return $this; } public function getType(): string { return $this->type; } public function setType(string $type): OutboundMessage { $this->type = $type; return $this; } } Message/Binary.php 0000644 00000002277 15107375377 0010114 0 ustar 00 <?php /** * Vonage Client Library for PHP * * @copyright Copyright (c) 2016-2022 Vonage, Inc. (http://vonage.com) * @license https://github.com/Vonage/vonage-php-sdk-core/blob/master/LICENSE.txt Apache License 2.0 */ declare(strict_types=1); namespace Vonage\SMS\Message; class Binary extends OutboundMessage { /** * @var string */ protected string $type = 'binary'; public function __construct(string $to, string $from, protected string $body, protected string $udh, protected ?int $protocolId = null) { parent::__construct($to, $from); } /** * @return mixed */ public function toArray(): array { $data = [ 'body' => $this->getBody(), 'udh' => $this->getUdh(), ]; if ($this->getProtocolId()) { $data['protocol-id'] = $this->getProtocolId(); } $data = $this->appendUniversalOptions($data); return $data; } public function getBody(): string { return $this->body; } public function getUdh(): string { return $this->udh; } public function getProtocolId(): ?int { return $this->protocolId; } }
Simpan