1 | <?php |
||
31 | class Chat extends Entity |
||
32 | { |
||
33 | 16 | public function __construct($data) |
|
34 | { |
||
35 | 16 | parent::__construct($data); |
|
36 | |||
37 | 16 | $id = $this->getId(); |
|
38 | 16 | $type = $this->getType(); |
|
39 | 16 | if (!$type) { |
|
40 | 5 | $id > 0 && $this->type = 'private'; |
|
41 | 5 | $id < 0 && $this->type = 'group'; |
|
42 | } |
||
43 | 16 | } |
|
44 | |||
45 | /** |
||
46 | * Try to mention the user of this chat, else return the title |
||
47 | * |
||
48 | * @param bool $escape_markdown |
||
49 | * |
||
50 | * @return string|null |
||
51 | */ |
||
52 | 1 | public function tryMention($escape_markdown = false) |
|
60 | |||
61 | /** |
||
62 | * Check if this is a group chat |
||
63 | * |
||
64 | * @return bool |
||
65 | */ |
||
66 | 1 | public function isGroupChat() |
|
70 | |||
71 | /** |
||
72 | * Check if this is a private chat |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | 2 | public function isPrivateChat() |
|
80 | |||
81 | /** |
||
82 | * Check if this is a super group |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 1 | public function isSuperGroup() |
|
90 | |||
91 | /** |
||
92 | * Check if this is a channel |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | 1 | public function isChannel() |
|
100 | } |
||
101 |