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

Sticker::setWidth()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
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 Sticker
11
 * This object represents a sticker.
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class Sticker extends BaseType implements TypeInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    static protected $requiredParams = ['file_id', 'width', 'height'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    static protected $map = [
30
        'file_id' => true,
31
        'width' => true,
32
        'height' => true,
33
        'thumb' => PhotoSize::class,
34
        'file_size' => true,
35
    ];
36
37
    /**
38
     * Identifier for this file, which can be used to download or reuse the file
39
     *
40
     * @var string
41
     */
42
    protected $fileId;
43
44
    /**
45
     * Unique identifier for this file, which is supposed
46
     * to be thesame over time and for different bots.
47
     * Can't be used to download or reuse the file.
48
     *
49
     * @var string
50
     */
51
    protected $fileUniqueId;
52
53
    /**
54
     * Sticker width
55
     *
56
     * @var int
57
     */
58
    protected $width;
59
60
    /**
61
     * Sticker height
62
     *
63
     * @var int
64
     */
65
    protected $height;
66
67
    /**
68
     * Document thumbnail as defined by sender
69
     *
70
     * @var PhotoSize
71
     */
72
    protected $thumb;
73
74
    /**
75
     * Optional. File size
76
     *
77
     * @var int
78
     */
79
    protected $fileSize;
80
81
    /**
82
     * @return string
83
     */
84 1
    public function getFileId()
85
    {
86 1
        return $this->fileId;
87
    }
88
89
    /**
90
     * @param string $fileId
91
     */
92 5
    public function setFileId($fileId)
93
    {
94 5
        $this->fileId = $fileId;
95 5
    }
96
97
    /**
98
     * @return string
99
     */
100
    public function getFileUniqueId()
101
    {
102
        return $this->fileUniqueId;
103
    }
104
105
    /**
106
     * @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...
107
     */
108
    public function setFileUniqueId($fileUniqueId)
109
    {
110
        $this->fileUniqueId = $fileUniqueId;
111
    }
112
113
    /**
114
     * @return int
115
     */
116 1
    public function getFileSize()
117
    {
118 1
        return $this->fileSize;
119
    }
120
121
    /**
122
     * @param int $fileSize
123
     *
124
     * @throws InvalidArgumentException
125
     */
126 6
    public function setFileSize($fileSize)
127
    {
128 6
        if (is_integer($fileSize)) {
129 5
            $this->fileSize = $fileSize;
130 5
        } else {
131 1
            throw new InvalidArgumentException();
132
        }
133 5
    }
134
135
    /**
136
     * @return int
137
     */
138 1
    public function getHeight()
139
    {
140 1
        return $this->height;
141
    }
142
143
    /**
144
     * @param int $height
145
     *
146
     * @throws InvalidArgumentException
147
     */
148 6
    public function setHeight($height)
149
    {
150 6
        if (is_integer($height)) {
151 5
            $this->height = $height;
152 5
        } else {
153 1
            throw new InvalidArgumentException();
154
        }
155 5
    }
156
157
    /**
158
     * @return PhotoSize
159
     */
160 1
    public function getThumb()
161
    {
162 1
        return $this->thumb;
163
    }
164
165
    /**
166
     * @param PhotoSize $thumb
167
     */
168 5
    public function setThumb(PhotoSize $thumb)
169
    {
170 5
        $this->thumb = $thumb;
171 5
    }
172
173
    /**
174
     * @return int
175
     */
176 1
    public function getWidth()
177
    {
178 1
        return $this->width;
179
    }
180
181
    /**
182
     * @param int $width
183
     *
184
     * @throws InvalidArgumentException
185
     */
186 6
    public function setWidth($width)
187
    {
188 6
        if (is_integer($width)) {
189 5
            $this->width = $width;
190 5
        } else {
191 1
            throw new InvalidArgumentException();
192
        }
193 5
    }
194
}
195