| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.ansachsongkhoe.net/vendor/vonage/client-core/src/Message/ |
Upload File : |
<?php
/**
* Nexmo Client Library for PHP
*
* @copyright Copyright (c) 2016 Nexmo, Inc. (http://nexmo.com)
* @license https://github.com/Nexmo/nexmo-php/blob/master/LICENSE.txt MIT License
*/
namespace Nexmo\Message;
use Nexmo\Client\Exception\Exception;
use Nexmo\Message\Shortcode\Alert;
use Nexmo\Message\Shortcode\Marketing;
use Nexmo\Message\Shortcode\TwoFactor;
abstract class Shortcode
{
protected $to;
protected $custom;
protected $options;
public function __construct($to, array $custom = [], array $options = [])
{
$this->to = $to;
$this->custom = $custom;
$this->options = $options;
}
public function setCustom($custom)
{
$this->custom = $custom;
}
public function setOptions($options)
{
$this->options = $options;
}
public function getType()
{
return $this->type;
}
public function getRequestData()
{
// Options, then custom, then to. This is the priority
// we want so that people can't overwrite to with a custom param
return $this->options + $this->custom + [
'to' => $this->to
];
}
public static function createMessageFromArray($data)
{
if (!isset($data['type'])) {
throw new Exception('No type provided when creating a shortcode message');
}
if (!isset($data['to'])) {
throw new Exception('No to provided when creating a shortcode message');
}
$data['type'] = strtolower($data['type']);
if ($data['type'] === '2fa') {
$m = new TwoFactor($data['to']);
} elseif ($data['type'] === 'marketing') {
$m = new Marketing($data['to']);
} elseif ($data['type'] === 'alert') {
$m = new Alert($data['to']);
}
if (isset($data['custom'])) {
$m->setCustom($data['custom']);
}
if (isset($data['options'])) {
$m->setOptions($data['options']);
}
return $m;
}
}