SetFileGenerationProgress::getExpectedSize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
 * Informs TDLib on a file generation progress.
13
 */
14
class SetFileGenerationProgress extends TdFunction
15
{
16
    public const TYPE_NAME = 'setFileGenerationProgress';
17
18
    /**
19
     * The identifier of the generation process.
20
     */
21
    protected string $generationId;
22
23
    /**
24
     * Expected size of the generated file, in bytes; 0 if unknown.
25
     */
26
    protected int $expectedSize;
27
28
    /**
29
     * The number of bytes already generated.
30
     */
31
    protected int $localPrefixSize;
32
33
    public function __construct(string $generationId, int $expectedSize, int $localPrefixSize)
34
    {
35
        $this->generationId    = $generationId;
36
        $this->expectedSize    = $expectedSize;
37
        $this->localPrefixSize = $localPrefixSize;
38
    }
39
40
    public static function fromArray(array $array): SetFileGenerationProgress
41
    {
42
        return new static(
43
            $array['generation_id'],
44
            $array['expected_size'],
45
            $array['local_prefix_size'],
46
        );
47
    }
48
49
    public function typeSerialize(): array
50
    {
51
        return [
52
            '@type'             => static::TYPE_NAME,
53
            'generation_id'     => $this->generationId,
54
            'expected_size'     => $this->expectedSize,
55
            'local_prefix_size' => $this->localPrefixSize,
56
        ];
57
    }
58
59
    public function getGenerationId(): string
60
    {
61
        return $this->generationId;
62
    }
63
64
    public function getExpectedSize(): int
65
    {
66
        return $this->expectedSize;
67
    }
68
69
    public function getLocalPrefixSize(): int
70
    {
71
        return $this->localPrefixSize;
72
    }
73
}
74