Completed
Push — master ( 177829...0e58b8 )
by Gusev
02:52
created

MessageEntity::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
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 = '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()
81
    {
82
        return $this->type;
83
    }
84
85
    /**
86
     * @param string $type
87
     */
88
    public function setType($type)
89
    {
90
        $this->type = $type;
91
    }
92
93
    /**
94
     * @return int
95
     */
96
    public function getOffset()
97
    {
98
        return $this->offset;
99
    }
100
101
    /**
102
     * @param int $offset
103
     */
104
    public function setOffset($offset)
105
    {
106
        $this->offset = $offset;
107
    }
108
109
    /**
110
     * @return int
111
     */
112
    public function getLength()
113
    {
114
        return $this->length;
115
    }
116
117
    /**
118
     * @param int $length
119
     */
120
    public function setLength($length)
121
    {
122
        $this->length = $length;
123
    }
124
125
    /**
126
     * @return string
127
     */
128
    public function getUrl()
129
    {
130
        return $this->url;
131
    }
132
133
    /**
134
     * @param string $url
135
     */
136
    public function setUrl($url)
137
    {
138
        $this->url = $url;
139
    }
140
}
141