Completed
Pull Request — master (#13)
by Jhao
03:24
created

Address::getSlash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Services\Responses;
6
7
use JMS\Serializer\Annotation AS JMS;
8
9
final class Address
10
{
11
    /**
12
     * Коды качества нормализации адреса.
13
     *
14
     * @see https://otpravka.pochta.ru/specification#/enums-clean-address-quality
15
     */
16
    public const QUALITY_GOOD = 'GOOD';
17
    public const QUALITY_ON_DEMAND = 'ON_DEMAND';
18
    public const QUALITY_POSTAL_BOX = 'POSTAL_BOX';
19
    public const QUALITY_UNDEF_01 = 'UNDEF_01';
20
    public const QUALITY_UNDEF_02 = 'UNDEF_02';
21
    public const QUALITY_UNDEF_03 = 'UNDEF_03';
22
    public const QUALITY_UNDEF_04 = 'UNDEF_04';
23
    public const QUALITY_UNDEF_05 = 'UNDEF_05';
24
    public const QUALITY_UNDEF_06 = 'UNDEF_06';
25
    public const QUALITY_UNDEF_07 = 'UNDEF_07';
26
27
    /**
28
     * Коды проверки нормализации адреса.
29
     *
30
     * @https://otpravka.pochta.ru/specification#/enums-clean-address-validation
31
     */
32
    public const VALIDATION_VALIDATED = 'VALIDATED';
33
    public const VALIDATION_OVERRIDDEN = 'OVERRIDDEN';
34
    public const VALIDATION_CONFIRMED_MANUALLY = 'CONFIRMED_MANUALLY';
35
36
    /**
37
     * @JMS\Type("string")
38
     * @var string
39
     */
40
    private $id;
41
42
    /**
43
     * @JMS\Type("string")
44
     * @var string|null
45
     */
46
    private $index;
47
48
    /**
49
     * @JMS\Type("string")
50
     * @var string|null
51
     */
52
    private $area;
53
54
    /**
55
     * @JMS\Type("string")
56
     * @var string|null
57
     */
58
    private $place;
59
60
    /**
61
     * @JMS\Type("string")
62
     * @var string|null
63
     */
64
    private $region;
65
66
    /**
67
     * @JMS\Type("string")
68
     * @var string|null
69
     */
70
    private $location;
71
72
    /**
73
     * @JMS\Type("string")
74
     * @var string|null
75
     */
76
    private $street;
77
78
    /**
79
     * @JMS\Type("string")
80
     * @var string|null
81
     */
82
    private $house;
83
84
    /**
85
     * @JMS\Type("string")
86
     * @var string|null
87
     */
88
    private $room;
89
90
    /**
91
     * @JMS\Type("string")
92
     * @var string|null
93
     */
94
    private $slash;
95
96
    /**
97
     * @JMS\Type("string")
98
     * @var string|null
99
     */
100
    private $building;
101
102
    /**
103
     * @JMS\Type("string")
104
     * @var string|null
105
     */
106
    private $corpus;
107
108
    /**
109
     * @JMS\Type("string")
110
     * @var string|null
111
     */
112
    private $letter;
113
114
    /**
115
     * @JMS\Type("string")
116
     * @var string|null
117
     */
118
    protected $hotel;
119
120
    /**
121
     * @JMS\SerializedName("num-address-type")
122
     * @JMS\Type("string")
123
     * @var string|null
124
     */
125
    private $numAddressType;
126
127
    /**
128
     * @JMS\SerializedName("original-address")
129
     * @JMS\Type("string")
130
     * @var string
131
     */
132
    private $originalAddress;
133
134
    /**
135
     * @JMS\SerializedName("address-type")
136
     * @JMS\Type("string")
137
     * @var string
138
     */
139
    private $addressType;
140
141
    /**
142
     * @JMS\SerializedName("quality-code")
143
     * @JMS\Type("string")
144
     * @var string
145
     */
146
    private $qualityCode;
147
148
    /**
149
     * @JMS\SerializedName("validation-code")
150
     * @JMS\Type("string")
151
     * @var string
152
     */
153
    private $validationCode;
154
155
    public function isUseful(): bool
156
    {
157
        $quality = \in_array($this->qualityCode, [
158
            self::QUALITY_GOOD, self::QUALITY_POSTAL_BOX, self::QUALITY_ON_DEMAND, self::QUALITY_UNDEF_05,
159
        ]);
160
161
        $validity = \in_array($this->validationCode, [
162
            self::VALIDATION_VALIDATED, self::VALIDATION_OVERRIDDEN, self::VALIDATION_CONFIRMED_MANUALLY,
163
        ]);
164
165
        return $quality && $validity;
166
    }
167
168
    public function getId(): string
169
    {
170
        return $this->id;
171
    }
172
173
    public function getIndex(): ?string
174
    {
175
        return $this->index;
176
    }
177
178
    public function getArea(): ?string
179
    {
180
        return $this->area;
181
    }
182
183
    public function getPlace(): ?string
184
    {
185
        return $this->place;
186
    }
187
188
    public function getRegion(): ?string
189
    {
190
        return $this->region;
191
    }
192
193
    public function getLocation(): ?string
194
    {
195
        return $this->location;
196
    }
197
198
    public function getStreet(): ?string
199
    {
200
        return $this->street;
201
    }
202
203
    public function getHouse(): ?string
204
    {
205
        return $this->house;
206
    }
207
208
    public function getRoom(): ?string
209
    {
210
        return $this->room;
211
    }
212
213
    public function getSlash(): ?string
214
    {
215
        return $this->slash;
216
    }
217
218
    public function getBuilding(): ?string
219
    {
220
        return $this->building;
221
    }
222
223
    public function getCorpus(): ?string
224
    {
225
        return $this->corpus;
226
    }
227
228
    public function getLetter(): ?string
229
    {
230
        return $this->letter;
231
    }
232
233
    public function getHotel(): ?string
234
    {
235
        return $this->hotel;
236
    }
237
238
    public function getNumAddressType(): ?string
239
    {
240
        return $this->numAddressType;
241
    }
242
243
    public function getOriginalAddress(): string
244
    {
245
        return $this->originalAddress;
246
    }
247
248
    public function getAddressType(): string
249
    {
250
        return $this->addressType;
251
    }
252
253
    public function getQualityCode(): string
254
    {
255
        return $this->qualityCode;
256
    }
257
258
    public function getValidationCode(): string
259
    {
260
        return $this->validationCode;
261
    }
262
}
263