| Total Complexity | 8 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class PageBlockChatLink extends PageBlock |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'pageBlockChatLink'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Chat title. |
||
| 20 | */ |
||
| 21 | protected string $title; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Chat photo; may be null. |
||
| 25 | */ |
||
| 26 | protected ?ChatPhoto $photo; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Chat username, by which all other information about the chat should be resolved. |
||
| 30 | */ |
||
| 31 | protected string $username; |
||
| 32 | |||
| 33 | public function __construct(string $title, ?ChatPhoto $photo, string $username) |
||
| 34 | { |
||
| 35 | parent::__construct(); |
||
| 36 | |||
| 37 | $this->title = $title; |
||
| 38 | $this->photo = $photo; |
||
| 39 | $this->username = $username; |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function fromArray(array $array): PageBlockChatLink |
||
| 43 | { |
||
| 44 | return new static( |
||
| 45 | $array['title'], |
||
| 46 | (isset($array['photo']) ? TdSchemaRegistry::fromArray($array['photo']) : null), |
||
| 47 | $array['username'], |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function typeSerialize(): array |
||
| 58 | ]; |
||
| 59 | } |
||
| 60 | |||
| 61 | public function getTitle(): string |
||
| 62 | { |
||
| 63 | return $this->title; |
||
| 64 | } |
||
| 65 | |||
| 66 | public function getPhoto(): ?ChatPhoto |
||
| 67 | { |
||
| 68 | return $this->photo; |
||
| 69 | } |
||
| 70 | |||
| 71 | public function getUsername(): string |
||
| 74 | } |
||
| 75 | } |
||
| 76 |