| 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/Entity/ |
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\Entity;
/**
* Implements getRequestData from EntityInterface with a simple array. Request data stored in an array, and locked once
* a request object has been set.
*
* @see EntityInterface::getRequestData()
*/
trait RequestArrayTrait
{
/**
* @var array
*/
protected $requestData = [];
/**
* Get an array of params to use in an API request.
*/
public function getRequestData($sent = true)
{
if (!($this instanceof EntityInterface)) {
throw new \Exception(sprintf(
'%s can only be used if the class implements %s',
__TRAIT__,
EntityInterface::class
));
}
if ($sent && ($request = $this->getRequest())) {
$query = [];
parse_str($request->getUri()->getQuery(), $query);
return $query;
}
// Trigger a pre-getRequestData() hook for any last minute
// decision making that needs to be done, but only if
// it hasn't been sent already
if (method_exists($this, 'preGetRequestDataHook')) {
$this->preGetRequestDataHook();
}
return $this->requestData;
}
protected function setRequestData($name, $value)
{
if (!($this instanceof EntityInterface)) {
throw new \Exception(sprintf(
'%s can only be used if the class implements %s',
__TRAIT__,
EntityInterface::class
));
}
if ($this->getResponse()) {
throw new \RuntimeException(sprintf(
'can not set request parameter `%s` for `%s` after API request has be made',
$name,
get_class($this)
));
}
$this->requestData[$name] = $value;
return $this;
}
}