Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 57 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 * Mute incoming reports on a subject 11 * 12 * Lexicon: tools.ozone.moderation.defs.modEventMute 13 * Type: object 14 * 15 * @property string|null $comment 16 * @property int $durationInHours Indicates how long the subject should remain muted. 17 * 18 * Constraints: 19 * - Required: durationInHours 20 */ 21class ModEventMute extends Data 22{ 23 /** 24 * @param int $durationInHours Indicates how long the subject should remain muted. 25 */ 26 public function __construct( 27 public readonly int $durationInHours, 28 public readonly ?string $comment = null 29 ) { 30 } 31 32 /** 33 * Get the lexicon NSID for this data type. 34 * 35 * @return string 36 */ 37 public static function getLexicon(): string 38 { 39 return 'tools.ozone.moderation.defs.modEventMute'; 40 } 41 42 43 /** 44 * Create an instance from an array. 45 * 46 * @param array $data The data array 47 * @return static 48 */ 49 public static function fromArray(array $data): static 50 { 51 return new static( 52 durationInHours: $data['durationInHours'], 53 comment: $data['comment'] ?? null 54 ); 55 } 56 57}