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

File::getFileUniqueId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 File
11
 * This object represents a file ready to be downloaded.
12
 * The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>.
13
 * It is guaranteed that the link will be valid for at least 1 hour.
14
 * When the link expires, a new one can be requested by calling getFile.
15
 *
16
 * @package TelegramBot\Api\Types
17
 */
18
class File extends BaseType implements TypeInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @var array
24
     */
25
    static protected $requiredParams = ['file_id'];
26
27
    /**
28
     * {@inheritdoc}
29
     *
30
     * @var array
31
     */
32
    static protected $map = [
33
        'file_id' => true,
34
        'file_qunique_id' => true,
35
        'file_size' => true,
36
        'file_path' => 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
     * Optional. File size, if known
57
     *
58
     * @var int
59
     */
60
    protected $fileSize;
61
62
    /**
63
     * Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
64
     *
65
     * @var string
66
     */
67
    protected $filePath;
68
69
    /**
70
     * @return string
71
     */
72 1
    public function getFileId()
73
    {
74 1
        return $this->fileId;
75
    }
76
77
    /**
78
     * @param string $fileId
79
     */
80 3
    public function setFileId($fileId)
81
    {
82 3
        $this->fileId = $fileId;
83 3
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getFileUniqueId()
89
    {
90
        return $this->fileUniqueId;
91
    }
92
93
    /**
94
     * @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...
95
     */
96
    public function setFileUniqueId($fileUniqueId)
97
    {
98
        $this->fileUniqueId = $fileUniqueId;
99
    }
100
101
    /**
102
     * @return int
103
     */
104 1
    public function getFileSize()
105
    {
106 1
        return $this->fileSize;
107
    }
108
109
    /**
110
     * @param int $fileSize
111
     *
112
     * @throws InvalidArgumentException
113
     */
114 4
    public function setFileSize($fileSize)
115
    {
116 4
        if (is_integer($fileSize)) {
117 3
            $this->fileSize = $fileSize;
118 3
        } else {
119 1
            throw new InvalidArgumentException();
120
        }
121 3
    }
122
123
    /**
124
     * @return string
125
     */
126 1
    public function getFilePath()
127
    {
128 1
        return $this->filePath;
129
    }
130
131
    /**
132
     * @param string $filePath
133
     */
134 3
    public function setFilePath($filePath)
135
    {
136 3
        $this->filePath = $filePath;
137 3
    }
138
}
139