Laravel AT Protocol Client (alpha & unstable)
1<?php
2
3namespace SocialDept\AtpClient\Data\Responses\Atproto\Repo;
4
5use Illuminate\Contracts\Support\Arrayable;
6
7/**
8 * @implements Arrayable<string, mixed>
9 */
10class GetRecordResponse implements Arrayable
11{
12 public function __construct(
13 public readonly string $uri,
14 public readonly mixed $value,
15 public readonly ?string $cid = null,
16 ) {}
17
18 public static function fromArray(array $data): self
19 {
20 return new self(
21 uri: $data['uri'],
22 value: $data['value'],
23 cid: $data['cid'] ?? null,
24 );
25 }
26
27 public function toArray(): array
28 {
29 return [
30 'uri' => $this->uri,
31 'value' => $this->value,
32 'cid' => $this->cid,
33 ];
34 }
35}