Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class UpdateNotification extends Update |
||
15 | { |
||
16 | public const TYPE_NAME = 'updateNotification'; |
||
17 | |||
18 | /** |
||
19 | * Unique notification group identifier. |
||
20 | * |
||
21 | * @var int |
||
22 | */ |
||
23 | protected int $notificationGroupId; |
||
24 | |||
25 | /** |
||
26 | * Changed notification. |
||
27 | * |
||
28 | * @var Notification |
||
29 | */ |
||
30 | protected Notification $notification; |
||
31 | |||
32 | public function __construct(int $notificationGroupId, Notification $notification) |
||
38 | } |
||
39 | |||
40 | public static function fromArray(array $array): UpdateNotification |
||
41 | { |
||
42 | return new static( |
||
43 | $array['notification_group_id'], |
||
44 | TdSchemaRegistry::fromArray($array['notification']), |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | public function typeSerialize(): array |
||
49 | { |
||
50 | return [ |
||
51 | '@type' => static::TYPE_NAME, |
||
52 | 'notification_group_id' => $this->notificationGroupId, |
||
53 | 'notification' => $this->notification->typeSerialize(), |
||
54 | ]; |
||
55 | } |
||
56 | |||
57 | public function getNotificationGroupId(): int |
||
58 | { |
||
59 | return $this->notificationGroupId; |
||
60 | } |
||
61 | |||
62 | public function getNotification(): Notification |
||
65 | } |
||
66 | } |
||
67 |