AutoDownloadSettingsPresets   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getLow() 0 3 1
A fromArray() 0 6 1
A typeSerialize() 0 7 1
A getMedium() 0 3 1
A getHigh() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * Contains auto-download settings presets for the user.
13
 */
14
class AutoDownloadSettingsPresets extends TdObject
15
{
16
    public const TYPE_NAME = 'autoDownloadSettingsPresets';
17
18
    /**
19
     * Preset with lowest settings; supposed to be used by default when roaming.
20
     *
21
     * @var AutoDownloadSettings
22
     */
23
    protected AutoDownloadSettings $low;
24
25
    /**
26
     * Preset with medium settings; supposed to be used by default when using mobile data.
27
     *
28
     * @var AutoDownloadSettings
29
     */
30
    protected AutoDownloadSettings $medium;
31
32
    /**
33
     * Preset with highest settings; supposed to be used by default when connected on Wi-Fi.
34
     *
35
     * @var AutoDownloadSettings
36
     */
37
    protected AutoDownloadSettings $high;
38
39
    public function __construct(AutoDownloadSettings $low, AutoDownloadSettings $medium, AutoDownloadSettings $high)
40
    {
41
        $this->low    = $low;
42
        $this->medium = $medium;
43
        $this->high   = $high;
44
    }
45
46
    public static function fromArray(array $array): AutoDownloadSettingsPresets
47
    {
48
        return new static(
49
            TdSchemaRegistry::fromArray($array['low']),
50
            TdSchemaRegistry::fromArray($array['medium']),
51
            TdSchemaRegistry::fromArray($array['high']),
52
        );
53
    }
54
55
    public function typeSerialize(): array
56
    {
57
        return [
58
            '@type'  => static::TYPE_NAME,
59
            'low'    => $this->low->typeSerialize(),
60
            'medium' => $this->medium->typeSerialize(),
61
            'high'   => $this->high->typeSerialize(),
62
        ];
63
    }
64
65
    public function getLow(): AutoDownloadSettings
66
    {
67
        return $this->low;
68
    }
69
70
    public function getMedium(): AutoDownloadSettings
71
    {
72
        return $this->medium;
73
    }
74
75
    public function getHigh(): AutoDownloadSettings
76
    {
77
        return $this->high;
78
    }
79
}
80