Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 68 lines 1.9 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 * Strings which describe the label in the UI, localized into a specific 11 * language. 12 * 13 * Lexicon: com.atproto.label.defs.labelValueDefinitionStrings 14 * Type: object 15 * 16 * @property string $lang The code of the language these strings are written in. 17 * @property string $name A short human-readable name for the label. 18 * @property string $description A longer description of what the label means and why it might be applied. 19 * 20 * Constraints: 21 * - Required: lang, name, description 22 * - lang: Format: language 23 * - name: Max length: 640 24 * - name: Max graphemes: 64 25 * - description: Max length: 100000 26 * - description: Max graphemes: 10000 27 */ 28class LabelValueDefinitionStrings extends Data 29{ 30 /** 31 * @param string $lang The code of the language these strings are written in. 32 * @param string $name A short human-readable name for the label. 33 * @param string $description A longer description of what the label means and why it might be applied. 34 */ 35 public function __construct( 36 public readonly string $lang, 37 public readonly string $name, 38 public readonly string $description 39 ) { 40 } 41 42 /** 43 * Get the lexicon NSID for this data type. 44 * 45 * @return string 46 */ 47 public static function getLexicon(): string 48 { 49 return 'com.atproto.label.defs.labelValueDefinitionStrings'; 50 } 51 52 53 /** 54 * Create an instance from an array. 55 * 56 * @param array $data The data array 57 * @return static 58 */ 59 public static function fromArray(array $data): static 60 { 61 return new static( 62 lang: $data['lang'], 63 name: $data['name'], 64 description: $data['description'] 65 ); 66 } 67 68}