Passed
Pull Request — master (#288)
by
unknown
02:36
created

MessageEntity::getLength()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: iGusev
5
 * Date: 13/04/16
6
 * Time: 04:10
7
 */
8
9
namespace TelegramBot\Api\Types;
10
11
use TelegramBot\Api\BaseType;
12
use TelegramBot\Api\TypeInterface;
13
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()
103
    {
104
        return $this->type;
105
    }
106
107
    /**
108
     * @param string $type
109
     */
110 1
    public function setType($type)
111
    {
112 1
        $this->type = $type;
113 1
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getOffset()
119
    {
120
        return $this->offset;
121
    }
122
123
    /**
124
     * @param int $offset
125
     */
126 1
    public function setOffset($offset)
127
    {
128 1
        $this->offset = $offset;
129 1
    }
130
131
    /**
132
     * @return int
133
     */
134
    public function getLength()
135
    {
136
        return $this->length;
137
    }
138
139
    /**
140
     * @param int $length
141
     */
142 1
    public function setLength($length)
143
    {
144 1
        $this->length = $length;
145 1
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getUrl()
151
    {
152
        return $this->url;
153
    }
154
155
    /**
156
     * @param string $url
157
     */
158
    public function setUrl($url)
159
    {
160
        $this->url = $url;
161
    }
162
    
163
    /**
164
     * @return User
165
     */
166
    public function getUser()
167
    {
168
        return $this->user;
169
    }
170
171
    /**
172
     * @param User $user
173
     */
174
    public function setUser($user)
175
    {
176
        $this->user = $user;
177
    }
178
179
    /**
180
     * @return string
181
     */
182
    public function getLanguage()
183
    {
184
        return $this->language;
185
    }
186
187
    /**
188
     * @param string $language
189
     */
190
    public function setLanguage($language)
191
    {
192
        $this->language = $language;
193
    }
194
}
195