Something went wrong. Try again.
A barebones implementation of an atproto PDS in PHP and Slim Framework 4.
pds php atproto
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081<?php
declare(strict_types=1);
namespace App\Domain\Pds\Atproto\Server;
use JsonSerializable;
class DescribeServerResponse implements JsonSerializable{ private string $did;
private bool $inviteCodeRequired;
/** @var list<string> */ private array $availableUserDomains;
private ?string $termsOfServiceUrl;
private ?string $privacyPolicyUrl;
private ?string $email;
private ?bool $phoneVerificationRequired;
/** * @param list<string> $availableUserDomains */ public function __construct( string $did, bool $inviteCodeRequired, array $availableUserDomains, ?string $termsOfServiceUrl, ?string $privacyPolicyUrl, ?string $email, ?bool $phoneVerificationRequired ) { $this->inviteCodeRequired = $inviteCodeRequired; $this->phoneVerificationRequired = $phoneVerificationRequired; $this->availableUserDomains = $availableUserDomains; $this->termsOfServiceUrl = $termsOfServiceUrl; $this->privacyPolicyUrl = $privacyPolicyUrl; $this->email = $email; $this->did = $did; }
/** * @return array<string, mixed> */ public function jsonSerialize(): array { $json = [ 'did' => $this->did, 'inviteCodeRequired' => $this->inviteCodeRequired, 'availableUserDomains' => $this->availableUserDomains, ];
if ($this->phoneVerificationRequired !== null) { $json['phoneVerificationRequired'] = $this->phoneVerificationRequired; }
if ($this->email) { $json['contact'] = ['email' => $this->email]; }
if ($this->termsOfServiceUrl || $this->privacyPolicyUrl) { $json['links'] = [];
if ($this->termsOfServiceUrl) { $json['links']['termsOfService'] = $this->termsOfServiceUrl; }
if ($this->privacyPolicyUrl) { $json['links']['privacyPolicy'] = $this->privacyPolicyUrl; } }
return $json; }}