Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

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

Wrap Ozone response arrays in Laravel Collections

+20 -18
+5 -5
src/Data/Responses/Ozone/Moderation/QueryEventsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Moderation; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs\ModEventView; 6 7 7 8 class QueryEventsResponse 8 9 { 9 10 /** 10 - * @param array<ModEventView> $events 11 + * @param Collection<int, ModEventView> $events 11 12 */ 12 13 public function __construct( 13 - public readonly array $events, 14 + public readonly Collection $events, 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 - events: array_map( 21 - fn (array $event) => ModEventView::fromArray($event), 22 - $data['events'] ?? [] 21 + events: collect($data['events'] ?? [])->map( 22 + fn (array $event) => ModEventView::fromArray($event) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Ozone/Moderation/QueryStatusesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Moderation; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs\SubjectStatusView; 6 7 7 8 class QueryStatusesResponse 8 9 { 9 10 /** 10 - * @param array<SubjectStatusView> $subjectStatuses 11 + * @param Collection<int, SubjectStatusView> $subjectStatuses 11 12 */ 12 13 public function __construct( 13 - public readonly array $subjectStatuses, 14 + public readonly Collection $subjectStatuses, 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 - subjectStatuses: array_map( 21 - fn (array $status) => SubjectStatusView::fromArray($status), 22 - $data['subjectStatuses'] ?? [] 21 + subjectStatuses: collect($data['subjectStatuses'] ?? [])->map( 22 + fn (array $status) => SubjectStatusView::fromArray($status) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Ozone/Moderation/SearchReposResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Moderation; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs\RepoView; 6 7 7 8 class SearchReposResponse 8 9 { 9 10 /** 10 - * @param array<RepoView> $repos 11 + * @param Collection<int, RepoView> $repos 11 12 */ 12 13 public function __construct( 13 - public readonly array $repos, 14 + public readonly Collection $repos, 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 - repos: array_map( 21 - fn (array $repo) => RepoView::fromArray($repo), 22 - $data['repos'] ?? [] 21 + repos: collect($data['repos'] ?? [])->map( 22 + fn (array $repo) => RepoView::fromArray($repo) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -3
src/Data/Responses/Ozone/Team/ListMembersResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Team; 4 4 5 + use Illuminate\Support\Collection; 6 + 5 7 class ListMembersResponse 6 8 { 7 9 /** 8 - * @param array<array<string, mixed>> $members Array of team member objects 10 + * @param Collection<int, array<string, mixed>> $members Collection of team member objects 9 11 */ 10 12 public function __construct( 11 - public readonly array $members, 13 + public readonly Collection $members, 12 14 public readonly ?string $cursor = null, 13 15 ) {} 14 16 15 17 public static function fromArray(array $data): self 16 18 { 17 19 return new self( 18 - members: $data['members'] ?? [], 20 + members: collect($data['members'] ?? []), 19 21 cursor: $data['cursor'] ?? null, 20 22 ); 21 23 }