Passed
Push — main ( bd6751...4aef09 )
by Miaad
10:17
created

file   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 35
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A link() 0 2 1
A __construct() 0 3 2
1
<?php
2
3
namespace BPT\types;
4
5
use BPT\settings;
6
use stdClass;
7
8
/**
9
 * This object represents a file ready to be downloaded. The file can be downloaded via the link
10
 * https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at
11
 * least 1 hour. When the link expires, a new one can be requested by calling getFile.
12
 */
13
class file extends types {
0 ignored issues
show
Bug introduced by
The type BPT\types\types was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
    /** Keep all of properties which has sub properties */
15
    private const subs = [];
16
17
    /** Identifier for this file, which can be used to download or reuse the file */
18
    public string $id;
19
20
    /** Identifier for this file, which can be used to download or reuse the file */
21
    public string $file_id;
22
23
    /**
24
     * Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be
25
     * used to download or reuse the file.
26
     */
27
    public string $file_unique_id;
28
29
    /**
30
     * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
31
     * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
32
     * integer or double-precision float type are safe for storing this value.
33
     */
34
    public null|int $file_size = null;
35
36
    /** Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
37
    public null|string $file_path = null;
38
39
40
    public function __construct(stdClass|null $object = null) {
41
        if ($object != null) {
42
            parent::__construct($object, self::subs);
43
        }
44
    }
45
46
    public function link(): string {
47
        return settings::$down_url . 'bot' . settings::$token . '/' . $this->file_path;
48
    }
49
}
50