phptdgram /
schema
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This phpFile is auto-generated. |
||
| 5 | */ |
||
| 6 | |||
| 7 | declare(strict_types=1); |
||
| 8 | |||
| 9 | namespace PHPTdGram\Schema; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Contains a list of messages. |
||
| 13 | */ |
||
| 14 | class Messages extends TdObject |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'messages'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Approximate total count of messages found. |
||
| 20 | */ |
||
| 21 | protected int $totalCount; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * List of messages; messages may be null. |
||
| 25 | * |
||
| 26 | * @var Message[]|null |
||
| 27 | */ |
||
| 28 | protected ?array $messages; |
||
| 29 | |||
| 30 | public function __construct(int $totalCount, ?array $messages) |
||
| 31 | { |
||
| 32 | $this->totalCount = $totalCount; |
||
| 33 | $this->messages = $messages; |
||
| 34 | } |
||
| 35 | |||
| 36 | public static function fromArray(array $array): Messages |
||
| 37 | { |
||
| 38 | return new static( |
||
| 39 | $array['total_count'], |
||
| 40 | (isset($array['messages']) ? array_map(fn ($x) => TdSchemaRegistry::fromArray($x), $array['messages']) : null), |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function typeSerialize(): array |
||
| 45 | { |
||
| 46 | return [ |
||
| 47 | '@type' => static::TYPE_NAME, |
||
| 48 | 'total_count' => $this->totalCount, |
||
| 49 | (isset($this->messages) ? array_map(fn ($x) => $x->typeSerialize(), $this->messages) : null), |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 50 | ]; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function getTotalCount(): int |
||
| 54 | { |
||
| 55 | return $this->totalCount; |
||
| 56 | } |
||
| 57 | |||
| 58 | public function getMessages(): ?array |
||
| 59 | { |
||
| 60 | return $this->messages; |
||
| 61 | } |
||
| 62 | } |
||
| 63 |