Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

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

Wrap Bsky Actor response arrays in Laravel Collections

+20 -20
+5 -5
src/Data/Responses/Bsky/Actor/GetProfilesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileViewDetailed; 6 7 7 8 class GetProfilesResponse 8 9 { 9 10 /** 10 - * @param array<ProfileViewDetailed> $profiles 11 + * @param Collection<int, ProfileViewDetailed> $profiles 11 12 */ 12 13 public function __construct( 13 - public readonly array $profiles, 14 + public readonly Collection $profiles, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - profiles: array_map( 20 - fn (array $profile) => ProfileViewDetailed::fromArray($profile), 21 - $data['profiles'] ?? [] 20 + profiles: collect($data['profiles'] ?? [])->map( 21 + fn (array $profile) => ProfileViewDetailed::fromArray($profile) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Bsky/Actor/GetSuggestionsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetSuggestionsResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $actors 11 + * @param Collection<int, ProfileView> $actors 11 12 */ 12 13 public function __construct( 13 - public readonly array $actors, 14 + public readonly Collection $actors, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - actors: array_map( 21 - fn (array $actor) => ProfileView::fromArray($actor), 22 - $data['actors'] ?? [] 21 + actors: collect($data['actors'] ?? [])->map( 22 + fn (array $actor) => ProfileView::fromArray($actor) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Actor/SearchActorsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class SearchActorsResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $actors 11 + * @param Collection<int, ProfileView> $actors 11 12 */ 12 13 public function __construct( 13 - public readonly array $actors, 14 + public readonly Collection $actors, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - actors: array_map( 21 - fn (array $actor) => ProfileView::fromArray($actor), 22 - $data['actors'] ?? [] 21 + actors: collect($data['actors'] ?? [])->map( 22 + fn (array $actor) => ProfileView::fromArray($actor) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Actor/SearchActorsTypeaheadResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileViewBasic; 6 7 7 8 class SearchActorsTypeaheadResponse 8 9 { 9 10 /** 10 - * @param array<ProfileViewBasic> $actors 11 + * @param Collection<int, ProfileViewBasic> $actors 11 12 */ 12 13 public function __construct( 13 - public readonly array $actors, 14 + public readonly Collection $actors, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - actors: array_map( 20 - fn (array $actor) => ProfileViewBasic::fromArray($actor), 21 - $data['actors'] ?? [] 20 + actors: collect($data['actors'] ?? [])->map( 21 + fn (array $actor) => ProfileViewBasic::fromArray($actor) 22 22 ), 23 23 ); 24 24 }