Laravel AT Protocol Client (alpha & unstable)

Add Arrayable interface to Atproto Server response classes

Changed files
+38 -2
src
Data
+18 -1
src/Data/Responses/Atproto/Server/DescribeServerResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Atproto\Server; 4 4 5 - class DescribeServerResponse 5 + use Illuminate\Contracts\Support\Arrayable; 6 + 7 + /** 8 + * @implements Arrayable<string, mixed> 9 + */ 10 + class DescribeServerResponse implements Arrayable 6 11 { 7 12 /** 8 13 * @param array<string> $availableUserDomains ··· 26 31 links: $data['links'] ?? null, 27 32 contact: $data['contact'] ?? null, 28 33 ); 34 + } 35 + 36 + public function toArray(): array 37 + { 38 + return [ 39 + 'did' => $this->did, 40 + 'availableUserDomains' => $this->availableUserDomains, 41 + 'inviteCodeRequired' => $this->inviteCodeRequired, 42 + 'phoneVerificationRequired' => $this->phoneVerificationRequired, 43 + 'links' => $this->links, 44 + 'contact' => $this->contact, 45 + ]; 29 46 } 30 47 }
+20 -1
src/Data/Responses/Atproto/Server/GetSessionResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Atproto\Server; 4 4 5 - class GetSessionResponse 5 + use Illuminate\Contracts\Support\Arrayable; 6 + 7 + /** 8 + * @implements Arrayable<string, mixed> 9 + */ 10 + class GetSessionResponse implements Arrayable 6 11 { 7 12 public function __construct( 8 13 public readonly string $handle, ··· 27 32 active: $data['active'] ?? null, 28 33 status: $data['status'] ?? null, 29 34 ); 35 + } 36 + 37 + public function toArray(): array 38 + { 39 + return [ 40 + 'handle' => $this->handle, 41 + 'did' => $this->did, 42 + 'email' => $this->email, 43 + 'emailConfirmed' => $this->emailConfirmed, 44 + 'emailAuthFactor' => $this->emailAuthFactor, 45 + 'didDoc' => $this->didDoc, 46 + 'active' => $this->active, 47 + 'status' => $this->status, 48 + ]; 30 49 } 31 50 }