Passed
Pull Request — master (#32)
by Artem
07:12
created

History::getTaxPeriodId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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