Passed
Push — master ( 3bfee0...112fc6 )
by Nikolay
02:02
created

GetFileMethod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 5
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
/**
8
 * Class GetFileMethod.
9
 *
10
 * Use this method to get basic info about a file and prepare it for downloading.
11
 * For the moment, bots can download files of up to 20MB in size. On success, a File object is returned.
12
 * The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>,
13
 * where <file_path> is taken from the response.
14
 * It is guaranteed that the link will be valid for at least 1 hour.
15
 * When the link expires, a new one can be requested by calling getFile
16
 *
17
 * Note: This function may not preserve the original file name and MIME type.
18
 * You should save the file's MIME type and name (if available) when the File object is received.
19
 *
20
 * @see https://core.telegram.org/bots/api#getfile
21
 */
22
class GetFileMethod
23
{
24
    /**
25
     * File identifier to get info about.
26
     *
27
     * @var string
28
     */
29
    public $fileId;
30
31
    /**
32
     * @param string $fileId
33
     *
34
     * @return GetFileMethod
35
     */
36 6
    public static function create(string $fileId): GetFileMethod
37
    {
38 6
        $instance = new static();
39 6
        $instance->fileId = $fileId;
40
41 6
        return $instance;
42
    }
43
}
44