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