RemoteFile   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 84
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getIsUploadingActive() 0 3 1
A typeSerialize() 0 9 1
A __construct() 0 7 1
A getId() 0 3 1
A getUniqueId() 0 3 1
A getUploadedSize() 0 3 1
A fromArray() 0 8 1
A getIsUploadingCompleted() 0 3 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace PHPTdGram\Schema;
10
11
/**
12
 * Represents a remote file.
13
 */
14
class RemoteFile extends TdObject
15
{
16
    public const TYPE_NAME = 'remoteFile';
17
18
    /**
19
     * Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location.
20
     */
21
    protected string $id;
22
23
    /**
24
     * Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time.
25
     */
26
    protected string $uniqueId;
27
28
    /**
29
     * True, if the file is currently being uploaded (or a remote copy is being generated by some other means).
30
     */
31
    protected bool $isUploadingActive;
32
33
    /**
34
     * True, if a remote copy is fully available.
35
     */
36
    protected bool $isUploadingCompleted;
37
38
    /**
39
     * Size of the remote available part of the file; 0 if unknown.
40
     */
41
    protected int $uploadedSize;
42
43
    public function __construct(string $id, string $uniqueId, bool $isUploadingActive, bool $isUploadingCompleted, int $uploadedSize)
44
    {
45
        $this->id                   = $id;
46
        $this->uniqueId             = $uniqueId;
47
        $this->isUploadingActive    = $isUploadingActive;
48
        $this->isUploadingCompleted = $isUploadingCompleted;
49
        $this->uploadedSize         = $uploadedSize;
50
    }
51
52
    public static function fromArray(array $array): RemoteFile
53
    {
54
        return new static(
55
            $array['id'],
56
            $array['unique_id'],
57
            $array['is_uploading_active'],
58
            $array['is_uploading_completed'],
59
            $array['uploaded_size'],
60
        );
61
    }
62
63
    public function typeSerialize(): array
64
    {
65
        return [
66
            '@type'                  => static::TYPE_NAME,
67
            'id'                     => $this->id,
68
            'unique_id'              => $this->uniqueId,
69
            'is_uploading_active'    => $this->isUploadingActive,
70
            'is_uploading_completed' => $this->isUploadingCompleted,
71
            'uploaded_size'          => $this->uploadedSize,
72
        ];
73
    }
74
75
    public function getId(): string
76
    {
77
        return $this->id;
78
    }
79
80
    public function getUniqueId(): string
81
    {
82
        return $this->uniqueId;
83
    }
84
85
    public function getIsUploadingActive(): bool
86
    {
87
        return $this->isUploadingActive;
88
    }
89
90
    public function getIsUploadingCompleted(): bool
91
    {
92
        return $this->isUploadingCompleted;
93
    }
94
95
    public function getUploadedSize(): int
96
    {
97
        return $this->uploadedSize;
98
    }
99
}
100