Test Failed
Pull Request — master (#292)
by
unknown
02:00
created

Audio   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 199
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 87.8%

Importance

Changes 0
Metric Value
wmc 16
lcom 2
cbo 2
dl 0
loc 199
ccs 36
cts 41
cp 0.878
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getFileId() 0 4 1
A setFileId() 0 4 1
A getFileUniqueId() 0 4 1
A setFileUniqueId() 0 4 1
A getDuration() 0 4 1
A setDuration() 0 8 2
A getPerformer() 0 4 1
A setPerformer() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getFileSize() 0 4 1
A setFileSize() 0 8 2
A getMimeType() 0 4 1
A setMimeType() 0 4 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', '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
     * Identifier for this file, which can be used to download or reuse the file
41
     *
42
     * @var string
43
     */
44
    protected $fileId;
45
46
    /**
47
     * Unique identifier for this file, which is supposed
48
     * to be thesame over time and for different bots.
49
     * Can't be used to download or reuse the file.
50
     *
51
     * @var string
52
     */
53
    protected $fileUniqueId;
54
55
    /**
56
     * Photo width
57
     *
58
     * @var int
59
     */
60
    protected $duration;
61
62
    /**
63
     * Optional. Performer of the audio as defined by sender or by audio tags
64
     *
65
     * @var string
66
     */
67
    protected $performer;
68
69
    /**
70
     * Optional. Title of the audio as defined by sender or by audio tags
71
     *
72
     * @var string
73
     */
74
    protected $title;
75
76
    /**
77
     * Optional. MIME type of the file as defined by sender
78
     *
79
     * @var string
80
     */
81
    protected $mimeType;
82
83
    /**
84
     * Optional. File size
85
     *
86
     * @var int
87
     */
88
    protected $fileSize;
89
90
    /**
91
     * @return string
92
     */
93 1
    public function getFileId()
94
    {
95 1
        return $this->fileId;
96
    }
97
98
    /**
99
     * @param string $fileId
100
     */
101 5
    public function setFileId($fileId)
102
    {
103 5
        $this->fileId = $fileId;
104 5
    }
105
106
    /**
107
     * @return string
108
     */
109
    public function getFileUniqueId()
110
    {
111
        return $this->fileUniqueId;
112
    }
113
114
    /**
115
     * @param string $fileId
0 ignored issues
show
Bug introduced by
There is no parameter named $fileId. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
116
     */
117
    public function setFileUniqueId($fileUniqueId)
118
    {
119
        $this->fileUniqueId = $fileUniqueId;
120
    }
121
122
    /**
123
     * @return int
124
     */
125 1
    public function getDuration()
126
    {
127 1
        return $this->duration;
128
    }
129
130
    /**
131
     * @param int $duration
132
     *
133
     * @throws InvalidArgumentException
134
     */
135 6
    public function setDuration($duration)
136
    {
137 6
        if (is_integer($duration)) {
138 5
            $this->duration = $duration;
139 5
        } else {
140 1
            throw new InvalidArgumentException();
141
        }
142 5
    }
143
144
    /**
145
     * @return string
146
     */
147 1
    public function getPerformer()
148
    {
149 1
        return $this->performer;
150
    }
151
152
    /**
153
     * @param string $performer
154
     */
155 3
    public function setPerformer($performer)
156
    {
157 3
        $this->performer = $performer;
158 3
    }
159
160
    /**
161
     * @return string
162
     */
163 1
    public function getTitle()
164
    {
165 1
        return $this->title;
166
    }
167
168
    /**
169
     * @param string $title
170
     */
171 3
    public function setTitle($title)
172
    {
173 3
        $this->title = $title;
174 3
    }
175
176
    /**
177
     * @return int
178
     */
179 1
    public function getFileSize()
180
    {
181 1
        return $this->fileSize;
182
    }
183
184
    /**
185
     * @param int $fileSize
186
     *
187
     * @throws InvalidArgumentException
188
     */
189 6
    public function setFileSize($fileSize)
190
    {
191 6
        if (is_integer($fileSize)) {
192 5
            $this->fileSize = $fileSize;
193 5
        } else {
194 1
            throw new InvalidArgumentException();
195
        }
196 5
    }
197
198
    /**
199
     * @return string
200
     */
201 1
    public function getMimeType()
202
    {
203 1
        return $this->mimeType;
204
    }
205
206
    /**
207
     * @param string $mimeType
208
     */
209 5
    public function setMimeType($mimeType)
210
    {
211 5
        $this->mimeType = $mimeType;
212 5
    }
213
}
214