Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 55 lines 1.3 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs; 4 5use SocialDept\AtpSchema\Data\Data; 6 7/** 8 * GENERATED CODE - DO NOT EDIT 9 * 10 * Add a comment to a subject. An empty comment will clear any previously set 11 * sticky comment. 12 * 13 * Lexicon: tools.ozone.moderation.defs.modEventComment 14 * Type: object 15 * 16 * @property string|null $comment 17 * @property bool|null $sticky Make the comment persistent on the subject 18 */ 19class ModEventComment extends Data 20{ 21 /** 22 * @param bool|null $sticky Make the comment persistent on the subject 23 */ 24 public function __construct( 25 public readonly ?string $comment = null, 26 public readonly ?bool $sticky = null 27 ) { 28 } 29 30 /** 31 * Get the lexicon NSID for this data type. 32 * 33 * @return string 34 */ 35 public static function getLexicon(): string 36 { 37 return 'tools.ozone.moderation.defs.modEventComment'; 38 } 39 40 41 /** 42 * Create an instance from an array. 43 * 44 * @param array $data The data array 45 * @return static 46 */ 47 public static function fromArray(array $data): static 48 { 49 return new static( 50 comment: $data['comment'] ?? null, 51 sticky: $data['sticky'] ?? null 52 ); 53 } 54 55}