1 | <?php |
||
14 | class MessageEntity extends BaseType implements TypeInterface |
||
15 | { |
||
16 | |||
17 | const TYPE_MENTION = 'mention'; |
||
18 | const TYPE_HASHTAG = 'hashtag'; |
||
19 | const TYPE_CASHTAG = 'cashtag'; |
||
20 | const TYPE_BOT_COMMAND = 'bot_command'; |
||
21 | const TYPE_URL = 'url'; |
||
22 | const TYPE_EMAIL = 'email'; |
||
23 | const TYPE_PHONE_NUMBER = 'phone_number'; |
||
24 | const TYPE_BOLD = 'bold'; |
||
25 | const TYPE_ITALIC = 'italic'; |
||
26 | const TYPE_UNDERLINE = 'underline'; |
||
27 | const TYPE_STRIKETHROUGH = 'strikethrough'; |
||
28 | const TYPE_CODE = 'code'; |
||
29 | const TYPE_PRE = 'pre'; |
||
30 | const TYPE_TEXT_LINK = 'text_link'; |
||
31 | const TYPE_TEXT_MENTION = 'text_mention'; |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | static protected $requiredParams = ['type', 'offset', 'length']; |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | static protected $map = [ |
||
46 | 'type' => true, |
||
47 | 'offset' => true, |
||
48 | 'length' => true, |
||
49 | 'url' => true, |
||
50 | 'user' => true, |
||
51 | 'language' => true, |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * Type of the entity. |
||
56 | * One of mention (@username), hashtag (#hashtag), cashtag ($USD), bot_command, url, email, phone_number, bold (bold text), |
||
57 | * italic (italic text), underline (underlined text), strikethrough (strikethrough text), code (monowidth string), |
||
58 | * pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames) |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $type; |
||
63 | |||
64 | /** |
||
65 | * Offset in UTF-16 code units to the start of the entity |
||
66 | * |
||
67 | * @var int |
||
68 | */ |
||
69 | protected $offset; |
||
70 | |||
71 | /** |
||
72 | * Length of the entity in UTF-16 code units |
||
73 | * |
||
74 | * @var int |
||
75 | */ |
||
76 | protected $length; |
||
77 | |||
78 | /** |
||
79 | * Optional. For “text_link” only, url that will be opened after user taps on the text |
||
80 | * |
||
81 | * @var string |
||
82 | */ |
||
83 | protected $url; |
||
84 | |||
85 | /** |
||
86 | * Optional. For “text_mention” only, the mentioned user |
||
87 | * |
||
88 | * @var User |
||
89 | */ |
||
90 | protected $user; |
||
91 | |||
92 | /** |
||
93 | * Optional. For “pre” only, the programming language of the entity text |
||
94 | * |
||
95 | * @var string |
||
96 | */ |
||
97 | protected $language; |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getType() |
||
106 | |||
107 | /** |
||
108 | * @param string $type |
||
109 | */ |
||
110 | 1 | public function setType($type) |
|
114 | |||
115 | /** |
||
116 | * @return int |
||
117 | */ |
||
118 | public function getOffset() |
||
122 | |||
123 | /** |
||
124 | * @param int $offset |
||
125 | */ |
||
126 | 1 | public function setOffset($offset) |
|
130 | |||
131 | /** |
||
132 | * @return int |
||
133 | */ |
||
134 | public function getLength() |
||
138 | |||
139 | /** |
||
140 | * @param int $length |
||
141 | */ |
||
142 | 1 | public function setLength($length) |
|
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getUrl() |
||
154 | |||
155 | /** |
||
156 | * @param string $url |
||
157 | */ |
||
158 | public function setUrl($url) |
||
162 | |||
163 | /** |
||
164 | * @return User |
||
165 | */ |
||
166 | public function getUser() |
||
170 | |||
171 | /** |
||
172 | * @param User $user |
||
173 | */ |
||
174 | public function setUser($user) |
||
178 | |||
179 | /** |
||
180 | * @return string |
||
181 | */ |
||
182 | public function getLanguage() |
||
186 | |||
187 | /** |
||
188 | * @param string $language |
||
189 | */ |
||
190 | public function setLanguage($language) |
||
194 | } |
||
195 |