Laravel AT Protocol Client (alpha & unstable)
at main 36 lines 902 B view raw
1<?php 2 3namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 5use Illuminate\Contracts\Support\Arrayable; 6use Illuminate\Support\Collection; 7 8/** 9 * @implements Arrayable<string, mixed> 10 */ 11class GetRelationshipsResponse implements Arrayable 12{ 13 /** 14 * @param Collection<int, mixed> $relationships Collection of Relationship or NotFoundActor objects 15 */ 16 public function __construct( 17 public readonly Collection $relationships, 18 public readonly ?string $actor = null, 19 ) {} 20 21 public static function fromArray(array $data): self 22 { 23 return new self( 24 relationships: collect($data['relationships'] ?? []), 25 actor: $data['actor'] ?? null, 26 ); 27 } 28 29 public function toArray(): array 30 { 31 return [ 32 'relationships' => $this->relationships->all(), 33 'actor' => $this->actor, 34 ]; 35 } 36}