Audio   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 200
Duplicated Lines 0 %

Test Coverage

Coverage 95.12%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 16
eloc 37
c 2
b 0
f 0
dl 0
loc 200
ccs 39
cts 41
cp 0.9512
rs 10

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getPerformer() 0 3 1
A getDuration() 0 3 1
A setDuration() 0 6 2
A getMimeType() 0 3 1
A setTitle() 0 3 1
A setFileSize() 0 6 2
A setPerformer() 0 3 1
A getFileSize() 0 3 1
A setFileUniqueId() 0 3 1
A getFileUniqueId() 0 3 1
A getFileId() 0 3 1
A setMimeType() 0 3 1
A setFileId() 0 3 1
A getTitle() 0 3 1
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\InvalidArgumentException;
7
use TelegramBot\Api\TypeInterface;
8
9
/**
10
 * Class Audio
11
 * This object represents an audio file (voice note).
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class Audio extends BaseType implements TypeInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    protected static $requiredParams = ['file_id', 'file_unique_id', 'duration'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    protected static $map = [
30
        'file_id' => true,
31
        'file_unique_id' => true,
32
        'duration' => true,
33
        'performer' => true,
34
        'title' => true,
35
        'mime_type' => true,
36
        'file_size' => true
37
    ];
38
39
    /**
40
     * Unique identifier for this file
41
     *
42
     * @var string
43
     */
44
    protected $fileId;
45
46
    /**
47
     * Photo width
48
     *
49
     * @var int
50
     */
51
    protected $duration;
52
53
    /**
54
     * Optional. Performer of the audio as defined by sender or by audio tags
55
     *
56
     * @var string|null
57
     */
58
    protected $performer;
59
60
    /**
61
     * Optional. Title of the audio as defined by sender or by audio tags
62
     *
63
     * @var string|null
64
     */
65
    protected $title;
66
67
    /**
68
     * Optional. MIME type of the file as defined by sender
69
     *
70
     * @var string|null
71
     */
72
    protected $mimeType;
73
74
    /**
75
     * Optional. File size
76
     *
77
     * @var int|null
78
     */
79
    protected $fileSize;
80
81
    /**
82
     * Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
83
     *
84
     * @var string
85
     */
86
    protected $fileUniqueId;
87
88
    /**
89
     * @return int
90
     */
91 1
    public function getDuration()
92
    {
93 1
        return $this->duration;
94
    }
95
96
    /**
97
     * @param mixed $duration
98
     * @return void
99
     * @throws InvalidArgumentException
100
     */
101 6
    public function setDuration($duration)
102
    {
103 6
        if (is_integer($duration)) {
104 5
            $this->duration = $duration;
105 5
        } else {
106 1
            throw new InvalidArgumentException();
107
        }
108 5
    }
109
110
    /**
111
     * @return null|string
112
     */
113 1
    public function getPerformer()
114
    {
115 1
        return $this->performer;
116
    }
117
118
    /**
119
     * @param string $performer
120
     * @return void
121 3
     */
122
    public function setPerformer($performer)
123 3
    {
124 3
        $this->performer = $performer;
125
    }
126
127
    /**
128
     * @return null|string
129 1
     */
130
    public function getTitle()
131 1
    {
132
        return $this->title;
133
    }
134
135
    /**
136
     * @param string $title
137 3
     * @return void
138
     */
139 3
    public function setTitle($title)
140 3
    {
141
        $this->title = $title;
142
    }
143
144
    /**
145 1
     * @return string
146
     */
147 1
    public function getFileId()
148
    {
149
        return $this->fileId;
150
    }
151
152
    /**
153 5
     * @param string $fileId
154
     * @return void
155 5
     */
156 5
    public function setFileId($fileId)
157
    {
158
        $this->fileId = $fileId;
159
    }
160
161 1
    /**
162
     * @return int|null
163 1
     */
164
    public function getFileSize()
165
    {
166
        return $this->fileSize;
167
    }
168
169
    /**
170
     * @param mixed $fileSize
171 6
     * @return void
172
     * @throws InvalidArgumentException
173 6
     */
174 5
    public function setFileSize($fileSize)
175 5
    {
176 1
        if (is_integer($fileSize)) {
177
            $this->fileSize = $fileSize;
178 5
        } else {
179
            throw new InvalidArgumentException();
180
        }
181
    }
182
183 1
    /**
184
     * @return null|string
185 1
     */
186
    public function getMimeType()
187
    {
188
        return $this->mimeType;
189
    }
190
191 5
    /**
192
     * @param string $mimeType
193 5
     * @return void
194 5
     */
195
    public function setMimeType($mimeType)
196
    {
197
        $this->mimeType = $mimeType;
198
    }
199
200
    /**
201
     * @return string
202
     */
203
    public function getFileUniqueId()
204
    {
205
        return $this->fileUniqueId;
206
    }
207 3
208
    /**
209 3
     * @param string $fileUniqueId
210 3
     * @return void
211
     */
212
    public function setFileUniqueId($fileUniqueId)
213
    {
214
        $this->fileUniqueId = $fileUniqueId;
215
    }
216
}
217