Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 53 lines 1.0 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\Com\Atproto\Label\Defs; 4 5use SocialDept\AtpSchema\Data\Data; 6 7/** 8 * GENERATED CODE - DO NOT EDIT 9 * 10 * Metadata tags on an atproto record, published by the author within the 11 * record. 12 * 13 * Lexicon: com.atproto.label.defs.selfLabels 14 * Type: object 15 * 16 * @property array $values 17 * 18 * Constraints: 19 * - Required: values 20 * - values: Max length: 10 21 */ 22class SelfLabels extends Data 23{ 24 public function __construct( 25 public readonly array $values 26 ) { 27 } 28 29 /** 30 * Get the lexicon NSID for this data type. 31 * 32 * @return string 33 */ 34 public static function getLexicon(): string 35 { 36 return 'com.atproto.label.defs.selfLabels'; 37 } 38 39 40 /** 41 * Create an instance from an array. 42 * 43 * @param array $data The data array 44 * @return static 45 */ 46 public static function fromArray(array $data): static 47 { 48 return new static( 49 values: $data['values'] ?? [] 50 ); 51 } 52 53}