1 | <?php |
||
14 | class MessageEntity extends BaseType implements TypeInterface |
||
15 | { |
||
16 | |||
17 | const TYPE_MENTION = 'mentin'; |
||
18 | const TYPE_HASHTAG = 'hashtag'; |
||
19 | const TYPE_BOT_COMMAND = 'bot_command'; |
||
20 | const TYPE_URL = 'url'; |
||
21 | const TYPE_EMAIL = 'email'; |
||
22 | const TYPE_BOLD = 'bold'; |
||
23 | const TYPE_ITALIC = 'italic'; |
||
24 | const TYPE_CODE = 'code'; |
||
25 | const TYPE_PRE = 'pre'; |
||
26 | const TYPE_TEXT_LINK = 'text_link'; |
||
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | static protected $requiredParams = ['type', 'offset', 'length']; |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | static protected $map = [ |
||
41 | 'type' => true, |
||
42 | 'offset' => true, |
||
43 | 'length' => true, |
||
44 | 'url' => true, |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * Type of the entity. |
||
49 | * One of mention (@username), hashtag, bot_command, url, email, bold (bold text), |
||
50 | * italic (italic text), code (monowidth string),pre (monowidth block), text_link (for clickable text URLs) |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $type; |
||
55 | |||
56 | /** |
||
57 | * Offset in UTF-16 code units to the start of the entity |
||
58 | * |
||
59 | * @var int |
||
60 | */ |
||
61 | protected $offset; |
||
62 | |||
63 | /** |
||
64 | * Length of the entity in UTF-16 code units |
||
65 | * |
||
66 | * @var int |
||
67 | */ |
||
68 | protected $length; |
||
69 | |||
70 | /** |
||
71 | * Optional. For “text_link” only, url that will be opened after user taps on the text |
||
72 | * |
||
73 | * @var string |
||
74 | */ |
||
75 | protected $url; |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getType() |
||
84 | |||
85 | /** |
||
86 | * @param string $type |
||
87 | */ |
||
88 | public function setType($type) |
||
92 | |||
93 | /** |
||
94 | * @return int |
||
95 | */ |
||
96 | public function getOffset() |
||
100 | |||
101 | /** |
||
102 | * @param int $offset |
||
103 | */ |
||
104 | public function setOffset($offset) |
||
108 | |||
109 | /** |
||
110 | * @return int |
||
111 | */ |
||
112 | public function getLength() |
||
116 | |||
117 | /** |
||
118 | * @param int $length |
||
119 | */ |
||
120 | public function setLength($length) |
||
124 | |||
125 | /** |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getUrl() |
||
132 | |||
133 | /** |
||
134 | * @param string $url |
||
135 | */ |
||
136 | public function setUrl($url) |
||
140 | } |
||
141 |