Passed
Push — master ( 049c4c...7327a7 )
by Artem
01:51
created

History::getDueDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoman4eg\Nalog\Model\Tax;
5
6
use Shoman4eg\Nalog\Model\CreatableFromArray;
7
8
/**
9
 * @author Artem Dubinin <[email protected]>
10
 */
11
final class History implements CreatableFromArray
12
{
13
    private int $taxPeriodId;
14
    private float $taxAmount;
15
    private float $bonusAmount;
16
    private float $paidAmount;
17
    private ?float $taxBaseAmount;
18
    private ?\DateTimeImmutable $chargeDate;
19
    private ?\DateTimeImmutable $dueDate;
20
    private string $oktmo;
21
    private string $regionName;
22
    private string $kbk;
23
    private string $taxOrganCode;
24
    private string $type;
25
    private int $krsbTaxChargeId;
26
    private int $receiptCount;
27
28
    private function __construct() {}
29
30
    /**
31
     * @throws \Exception
32
     */
33
    public static function createFromArray(array $data): self
34
    {
35
        $model = new self();
36
        $model->taxPeriodId = $data['taxPeriodId'];
37
        $model->taxAmount = $data['taxAmount'];
38
        $model->bonusAmount = $data['bonusAmount'];
39
        $model->paidAmount = $data['paidAmount'];
40
        $model->taxBaseAmount = $data['taxBaseAmount'];
41
        $model->chargeDate = $data['chargeDate'] ? new \DateTimeImmutable($data['chargeDate']) : null;
42
        $model->dueDate = $data['dueDate'] ? new \DateTimeImmutable($data['dueDate']) : null;
43
        $model->oktmo = $data['oktmo'];
44
        $model->regionName = $data['regionName'];
45
        $model->kbk = $data['kbk'];
46
        $model->taxOrganCode = $data['taxOrganCode'];
47
        $model->type = $data['type'];
48
        $model->krsbTaxChargeId = $data['krsbTaxChargeId'];
49
        $model->receiptCount = $data['receiptCount'];
50
51
        return $model;
52
    }
53
54
    public function getPaidAmount(): float
55
    {
56
        return $this->paidAmount;
57
    }
58
59
    public function getBonusAmount(): float
60
    {
61
        return $this->bonusAmount;
62
    }
63
64
    public function getTaxAmount(): float
65
    {
66
        return $this->taxAmount;
67
    }
68
69
    public function getTaxPeriodId(): int
70
    {
71
        return $this->taxPeriodId;
72
    }
73
74
    public function getOktmo(): string
75
    {
76
        return $this->oktmo;
77
    }
78
79
    public function getRegionName(): string
80
    {
81
        return $this->regionName;
82
    }
83
84
    public function getKbk(): string
85
    {
86
        return $this->kbk;
87
    }
88
89
    public function getTaxOrganCode(): string
90
    {
91
        return $this->taxOrganCode;
92
    }
93
94
    public function getKrsbTaxChargeId(): int
95
    {
96
        return $this->krsbTaxChargeId;
97
    }
98
99
    public function getReceiptCount(): int
100
    {
101
        return $this->receiptCount;
102
    }
103
104
    public function getType(): string
105
    {
106
        return $this->type;
107
    }
108
109
    public function getChargeDate(): ?\DateTimeImmutable
110
    {
111
        return $this->chargeDate;
112
    }
113
114
    public function getDueDate(): ?\DateTimeImmutable
115
    {
116
        return $this->dueDate;
117
    }
118
119
    public function getTaxBaseAmount(): ?float
120
    {
121
        return $this->taxBaseAmount;
122
    }
123
}
124