CalculationAddressLocation::getStateId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Calculation;
6
7
use JMS\Serializer\Annotation as Serializer;
8
use VasilDakov\Speedy\Model\CountryCode;
9
10
/**
11
 * Class CalculationAddressLocation.
12
 *
13
 * @Serializer\AccessType("public_method")
14
 *
15
 * @author Vasil Dakov <[email protected]>
16
 * @author Valentin Valkanov <[email protected]>
17
 * @copyright 2009-2022 Neutrino.bg
18
 *
19
 * @version 1.0
20
 */
21
class CalculationAddressLocation
22
{
23
    /**
24
     * Country ISO code. If not provided, local country is assumed. Used for all address types.
25
     */
26
    private CountryCode $countryId;
27
28
    /**
29
     * Required, if country supports states.
30
     */
31
    private string $stateId;
32
33
    /**
34
     * Required, if country has full site nomenclature and pair (siteType, siteName) is not provided.
35
     */
36
    private int $siteId;
37
38
    /**
39
     * Forbidden, if siteId is provided. Otherwise, is not mandatory.
40
     */
41
    private string $siteType;
42
43
    /**
44
     * Forbidden, if siteId is provided. Otherwise, is not mandatory.
45
     */
46
    private string $siteName;
47
48
    /**
49
     * Required if country requires postcode for addresses.
50
     */
51
    private string $postCode;
52
53 7
    public function __construct(int $siteId, string $postCode)
54
    {
55 7
        $this->setSiteId($siteId);
56 7
        $this->setPostCode($postCode);
57
    }
58
59
    /**
60
     * @return CountryCode countryId
61
     */
62 1
    public function getCountryId(): CountryCode
63
    {
64 1
        return $this->countryId;
65
    }
66
67 1
    public function setCountryId(CountryCode $countryId): self
68
    {
69 1
        $this->countryId = $countryId;
70
71 1
        return $this;
72
    }
73
74
    /**
75
     * @return string stateId
76
     */
77 1
    public function getStateId(): string
78
    {
79 1
        return $this->stateId;
80
    }
81
82 1
    public function setStateId(string $stateId): self
83
    {
84 1
        $this->stateId = $stateId;
85
86 1
        return $this;
87
    }
88
89
    /**
90
     * @return int stateId
91
     */
92 1
    public function getSiteId(): int
93
    {
94 1
        return $this->siteId;
95
    }
96
97 7
    private function setSiteId(int $siteId): void
98
    {
99 7
        $this->siteId = $siteId;
100
    }
101
102
    /**
103
     * @return string siteType
104
     */
105 1
    public function getSiteType(): string
106
    {
107 1
        return $this->siteType;
108
    }
109
110 1
    public function setSiteType(string $siteType): self
111
    {
112 1
        $this->siteType = $siteType;
113
114 1
        return $this;
115
    }
116
117
    /**
118
     * @return string siteName
119
     */
120 1
    public function getSiteName(): string
121
    {
122 1
        return $this->siteName;
123
    }
124
125 1
    public function setSiteName(string $siteName): self
126
    {
127 1
        $this->siteName = $siteName;
128
129 1
        return $this;
130
    }
131
132
    /**
133
     * @return string postCode
134
     */
135 1
    public function getPostCode(): string
136
    {
137 1
        return $this->postCode;
138
    }
139
140 7
    private function setPostCode(string $postCode): void
141
    {
142 7
        $this->postCode = $postCode;
143
    }
144
}
145