Date   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 getMonth() 0 3 1
A getDay() 0 3 1
A getYear() 0 3 1
A __construct() 0 5 1
A fromArray() 0 6 1
A typeSerialize() 0 7 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
 * Represents a date according to the Gregorian calendar.
13
 */
14
class Date extends TdObject
15
{
16
    public const TYPE_NAME = 'date';
17
18
    /**
19
     * Day of the month, 1-31.
20
     *
21
     * @var int
22
     */
23
    protected int $day;
24
25
    /**
26
     * Month, 1-12.
27
     *
28
     * @var int
29
     */
30
    protected int $month;
31
32
    /**
33
     * Year, 1-9999.
34
     *
35
     * @var int
36
     */
37
    protected int $year;
38
39
    public function __construct(int $day, int $month, int $year)
40
    {
41
        $this->day   = $day;
42
        $this->month = $month;
43
        $this->year  = $year;
44
    }
45
46
    public static function fromArray(array $array): Date
47
    {
48
        return new static(
49
            $array['day'],
50
            $array['month'],
51
            $array['year'],
52
        );
53
    }
54
55
    public function typeSerialize(): array
56
    {
57
        return [
58
            '@type' => static::TYPE_NAME,
59
            'day'   => $this->day,
60
            'month' => $this->month,
61
            'year'  => $this->year,
62
        ];
63
    }
64
65
    public function getDay(): int
66
    {
67
        return $this->day;
68
    }
69
70
    public function getMonth(): int
71
    {
72
        return $this->month;
73
    }
74
75
    public function getYear(): int
76
    {
77
        return $this->year;
78
    }
79
}
80