Laravel AT Protocol Client (alpha & unstable)
at main 44 lines 1.1 kB view raw
1<?php 2 3namespace SocialDept\AtpClient\Data\Responses\Atproto\Repo; 4 5use Illuminate\Contracts\Support\Arrayable; 6 7/** 8 * @implements Arrayable<string, mixed> 9 */ 10class DescribeRepoResponse implements Arrayable 11{ 12 /** 13 * @param array<string> $collections 14 */ 15 public function __construct( 16 public readonly string $handle, 17 public readonly string $did, 18 public readonly mixed $didDoc, 19 public readonly array $collections, 20 public readonly bool $handleIsCorrect, 21 ) {} 22 23 public static function fromArray(array $data): self 24 { 25 return new self( 26 handle: $data['handle'], 27 did: $data['did'], 28 didDoc: $data['didDoc'], 29 collections: $data['collections'] ?? [], 30 handleIsCorrect: $data['handleIsCorrect'], 31 ); 32 } 33 34 public function toArray(): array 35 { 36 return [ 37 'handle' => $this->handle, 38 'did' => $this->did, 39 'didDoc' => $this->didDoc, 40 'collections' => $this->collections, 41 'handleIsCorrect' => $this->handleIsCorrect, 42 ]; 43 } 44}