| Total Complexity | 5 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class SetPassportElementErrors extends TdFunction |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'setPassportElementErrors'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * User identifier. |
||
| 20 | */ |
||
| 21 | protected int $userId; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The errors. |
||
| 25 | * |
||
| 26 | * @var InputPassportElementError[] |
||
| 27 | */ |
||
| 28 | protected array $errors; |
||
| 29 | |||
| 30 | public function __construct(int $userId, array $errors) |
||
| 34 | } |
||
| 35 | |||
| 36 | public static function fromArray(array $array): SetPassportElementErrors |
||
| 37 | { |
||
| 38 | return new static( |
||
| 39 | $array['user_id'], |
||
| 40 | array_map(fn ($x) => TdSchemaRegistry::fromArray($x), $array['errors']), |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function typeSerialize(): array |
||
| 45 | { |
||
| 46 | return [ |
||
| 47 | '@type' => static::TYPE_NAME, |
||
| 48 | 'user_id' => $this->userId, |
||
| 49 | array_map(fn ($x) => $x->typeSerialize(), $this->errors), |
||
| 50 | ]; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function getUserId(): int |
||
| 54 | { |
||
| 55 | return $this->userId; |
||
| 56 | } |
||
| 57 | |||
| 58 | public function getErrors(): array |
||
| 61 | } |
||
| 62 | } |
||
| 63 |