Test Failed
Push — main ( 7b8973...13a4fc )
by Vasil
06:57 queued 03:30
created

FindSiteRequest::setRegion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Location\Site;
6
7
use VasilDakov\Speedy\Property;
8
use VasilDakov\Speedy\Traits\ToArray;
9
10
/**
11
 * Class FindSiteRequest.
12
 *
13
 * @author    Vasil Dakov <[email protected]>
14
 * @author    Valentin Valkanov <[email protected]>
15
 * @copyright 2009-2022 Neutrino.bg
16
 *
17
 * @version   1.0
18
 *
19
 * @see       https://services.speedy.bg/api/api_examples.html#FindSiteRequest
20
 */
21
class FindSiteRequest
22
{
23
    use ToArray;
0 ignored issues
show
Bug introduced by
The trait VasilDakov\Speedy\Traits\ToArray requires the property $value which is not provided by VasilDakov\Speedy\Servic...on\Site\FindSiteRequest.
Loading history...
24
25
    private int $countryId;
26
27
    private ?string $name = null;
28
29
    private ?string $postCode = null;
30
31
    private ?string $type = null;
32
33
    private ?string $municipality = null;
34 5
35
    private ?string $region = null;
36 5
37 5
    public function __construct(int $countryId, ?string $name = null, ?string $postCode = null)
38
    {
39
        $this->countryId = $countryId;
40 1
        $this->name      = $name;
41
        $this->postCode  = $postCode;
42 1
    }
43
44
    public function getCountryId(): int
45
    {
46
        return $this->countryId;
47
    }
48
49
    public function setCountryId(int $countryId): void
50 1
    {
51
        $this->countryId = $countryId;
52 1
    }
53
54
    public function getName(): ?string
55
    {
56
        return $this->name;
57
    }
58
59
    public function setName(?string $name): void
60 1
    {
61
        $this->name = $name;
62 1
    }
63
64
    public function getPostCode(): ?string
65 1
    {
66
        return $this->postCode;
67 1
    }
68
69
    public function setPostCode(?string $postCode): void
70 1
    {
71
        $this->postCode = $postCode;
72 1
    }
73
74
    public function getType(): ?string
75 1
    {
76
        return $this->type;
77 1
    }
78
79
    public function setType(?string $type): void
80 1
    {
81
        $this->type = $type;
82 1
    }
83
84
    public function getMunicipality(): ?string
85 1
    {
86
        return $this->municipality;
87 1
    }
88
89
    public function setMunicipality(?string $municipality): void
90
    {
91
        $this->municipality = $municipality;
92
    }
93
94
    /**
95
     * @param string|null $region
96
     */
97
    public function setRegion(?string $region): void
98
    {
99
        $this->region = $region;
100
    }
101
102
    /**
103
     * @return string|null
104
     */
105
    public function getRegion(): ?string
106
    {
107
        return $this->region;
108
    }
109
110
    /**
111
     * @return array<string,string|int|null>
112
     */
113
    public function toArray(): array
114
    {
115
        return [
116
            Property::COUNTRY_ID->value => $this->countryId,
117
            Property::NAME->value       => $this->name,
118
            Property::POST_CODE->value  => $this->postCode,
119
            Property::REGION->value => $this->region,
120
            Property::MUNICIPALITY->value => $this->municipality,
121
        ];
122
    }
123
}
124