Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 56 lines 1.1 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs; 4 5use SocialDept\AtpSchema\Data\Data; 6 7/** 8 * GENERATED CODE - DO NOT EDIT 9 * 10 * The subject's followers whom you also follow 11 * 12 * Lexicon: app.bsky.actor.defs.knownFollowers 13 * Type: object 14 * 15 * @property int $count 16 * @property array $followers 17 * 18 * Constraints: 19 * - Required: count, followers 20 * - followers: Max length: 5 21 * - followers: Min length: 0 22 */ 23class KnownFollowers extends Data 24{ 25 public function __construct( 26 public readonly int $count, 27 public readonly array $followers 28 ) { 29 } 30 31 /** 32 * Get the lexicon NSID for this data type. 33 * 34 * @return string 35 */ 36 public static function getLexicon(): string 37 { 38 return 'app.bsky.actor.defs.knownFollowers'; 39 } 40 41 42 /** 43 * Create an instance from an array. 44 * 45 * @param array $data The data array 46 * @return static 47 */ 48 public static function fromArray(array $data): static 49 { 50 return new static( 51 count: $data['count'], 52 followers: $data['followers'] ?? [] 53 ); 54 } 55 56}