Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Wrap Bsky Labeler response arrays in Laravel Collections

+5 -5
+5 -5
src/Data/Responses/Bsky/Labeler/GetServicesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Labeler; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Labeler\Defs\LabelerView; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Labeler\Defs\LabelerViewDetailed; 7 8 8 9 class GetServicesResponse 9 10 { 10 11 /** 11 - * @param array<LabelerView|LabelerViewDetailed> $views 12 + * @param Collection<int, LabelerView|LabelerViewDetailed> $views 12 13 */ 13 14 public function __construct( 14 - public readonly array $views, 15 + public readonly Collection $views, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data, bool $detailed = false): self 18 19 { 19 20 return new self( 20 - views: array_map( 21 + views: collect($data['views'] ?? [])->map( 21 22 fn (array $view) => $detailed 22 23 ? LabelerViewDetailed::fromArray($view) 23 - : LabelerView::fromArray($view), 24 - $data['views'] ?? [] 24 + : LabelerView::fromArray($view) 25 25 ), 26 26 ); 27 27 }