Passed
Push — master ( 58897c...6910c8 )
by Alexander
06:09 queued 12s
created

Audio::setFileId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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
    static protected $requiredParams = ['file_id', 'file_unique_id', 'duration'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    static protected $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
57
     */
58
    protected $performer;
59
60
    /**
61
     * Optional. Title of the audio as defined by sender or by audio tags
62
     *
63
     * @var string
64
     */
65
    protected $title;
66
67
    /**
68
     * Optional. MIME type of the file as defined by sender
69
     *
70
     * @var string
71
     */
72
    protected $mimeType;
73
74
    /**
75
     * Optional. File size
76
     *
77
     * @var int
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 int $duration
98
     *
99
     * @throws InvalidArgumentException
100
     */
101 6
    public function setDuration($duration)
102
    {
103 6
        if (is_integer($duration)) {
0 ignored issues
show
introduced by
The condition is_integer($duration) is always true.
Loading history...
104 5
            $this->duration = $duration;
105 5
        } else {
106 1
            throw new InvalidArgumentException();
107
        }
108 5
    }
109
110
    /**
111
     * @return string
112
     */
113 1
    public function getPerformer()
114
    {
115 1
        return $this->performer;
116
    }
117
118
    /**
119
     * @param string $performer
120
     */
121 3
    public function setPerformer($performer)
122
    {
123 3
        $this->performer = $performer;
124 3
    }
125
126
    /**
127
     * @return string
128
     */
129 1
    public function getTitle()
130
    {
131 1
        return $this->title;
132
    }
133
134
    /**
135
     * @param string $title
136
     */
137 3
    public function setTitle($title)
138
    {
139 3
        $this->title = $title;
140 3
    }
141
142
    /**
143
     * @return string
144
     */
145 1
    public function getFileId()
146
    {
147 1
        return $this->fileId;
148
    }
149
150
    /**
151
     * @param string $fileId
152
     */
153 5
    public function setFileId($fileId)
154
    {
155 5
        $this->fileId = $fileId;
156 5
    }
157
158
    /**
159
     * @return int
160
     */
161 1
    public function getFileSize()
162
    {
163 1
        return $this->fileSize;
164
    }
165
166
    /**
167
     * @param int $fileSize
168
     *
169
     * @throws InvalidArgumentException
170
     */
171 6
    public function setFileSize($fileSize)
172
    {
173 6
        if (is_integer($fileSize)) {
0 ignored issues
show
introduced by
The condition is_integer($fileSize) is always true.
Loading history...
174 5
            $this->fileSize = $fileSize;
175 5
        } else {
176 1
            throw new InvalidArgumentException();
177
        }
178 5
    }
179
180
    /**
181
     * @return string
182
     */
183 1
    public function getMimeType()
184
    {
185 1
        return $this->mimeType;
186
    }
187
188
    /**
189
     * @param string $mimeType
190
     */
191 5
    public function setMimeType($mimeType)
192
    {
193 5
        $this->mimeType = $mimeType;
194 5
    }
195
196
    /**
197
     * @return string
198
     */
199
    public function getFileUniqueId()
200
    {
201
        return $this->fileUniqueId;
202
    }
203
204
    /**
205
     * @param string $fileUniqueId
206
     */
207 3
    public function setFileUniqueId($fileUniqueId)
208
    {
209 3
        $this->fileUniqueId = $fileUniqueId;
210 3
    }
211
}
212