Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 50 lines 985 B view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\App\Bsky\Graph; 4 5use Carbon\Carbon; 6use SocialDept\AtpSchema\Data\Data; 7 8/** 9 * GENERATED CODE - DO NOT EDIT 10 * 11 * Lexicon: app.bsky.graph.block 12 * Type: record 13 */ 14class Block extends Data 15{ 16 /** 17 * @param string $subject DID of the account to be blocked. 18 */ 19 public function __construct( 20 public readonly string $subject, 21 public readonly Carbon $createdAt 22 ) { 23 } 24 25 /** 26 * Get the lexicon NSID for this data type. 27 * 28 * @return string 29 */ 30 public static function getLexicon(): string 31 { 32 return 'app.bsky.graph.block'; 33 } 34 35 36 /** 37 * Create an instance from an array. 38 * 39 * @param array $data The data array 40 * @return static 41 */ 42 public static function fromArray(array $data): static 43 { 44 return new static( 45 subject: $data['subject'], 46 createdAt: Carbon::parse($data['createdAt']) 47 ); 48 } 49 50}