| Total Complexity | 5 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class MessageAudio extends MessageContent |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'messageAudio'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The audio description. |
||
| 20 | */ |
||
| 21 | protected Audio $audio; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Audio caption. |
||
| 25 | */ |
||
| 26 | protected FormattedText $caption; |
||
| 27 | |||
| 28 | public function __construct(Audio $audio, FormattedText $caption) |
||
| 29 | { |
||
| 30 | parent::__construct(); |
||
| 31 | |||
| 32 | $this->audio = $audio; |
||
| 33 | $this->caption = $caption; |
||
| 34 | } |
||
| 35 | |||
| 36 | public static function fromArray(array $array): MessageAudio |
||
| 37 | { |
||
| 38 | return new static( |
||
| 39 | TdSchemaRegistry::fromArray($array['audio']), |
||
| 40 | TdSchemaRegistry::fromArray($array['caption']), |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function typeSerialize(): array |
||
| 45 | { |
||
| 46 | return [ |
||
| 47 | '@type' => static::TYPE_NAME, |
||
| 48 | 'audio' => $this->audio->typeSerialize(), |
||
| 49 | 'caption' => $this->caption->typeSerialize(), |
||
| 50 | ]; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function getAudio(): Audio |
||
| 56 | } |
||
| 57 | |||
| 58 | public function getCaption(): FormattedText |
||
| 61 | } |
||
| 62 | } |
||
| 63 |