*/ final class RetrieveResponse implements ResponseContract, ResponseHasMetaInformationContract { /** * @use ArrayAccessible */ use ArrayAccessible; use Fakeable; use HasMetaInformation; private function __construct( public readonly string $id, public readonly string $object, public readonly int $created, public readonly string $ownedBy, private readonly MetaInformation $meta, ) { } /** * Acts as static factory, and returns a new Response instance. * * @param array{id: string, object: string, created: int, owned_by: string} $attributes */ public static function from(array $attributes, MetaInformation $meta): self { return new self( $attributes['id'], $attributes['object'], $attributes['created'], $attributes['owned_by'], $meta, ); } /** * {@inheritDoc} */ public function toArray(): array { return [ 'id' => $this->id, 'object' => $this->object, 'created' => $this->created, 'owned_by' => $this->ownedBy, ]; } }