Test Failed
Pull Request — main (#21)
by Vasil
03:49
created

FindSiteRequest   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Test Coverage

Coverage 82.61%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 24
c 1
b 0
f 0
dl 0
loc 80
ccs 19
cts 23
cp 0.8261
rs 10
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 6 1
A getName() 0 3 1
A getPostCode() 0 3 1
A setType() 0 3 1
A __construct() 0 5 1
A setPostCode() 0 3 1
A getCountryId() 0 3 1
A setMunicipality() 0 3 1
A setName() 0 3 1
A setCountryId() 0 3 1
A getMunicipality() 0 3 1
A getType() 0 3 1
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
    public function __construct(int $countryId, ?string $name = null, ?string $postCode = null)
36 5
    {
37 5
        $this->countryId = $countryId;
38
        $this->name      = $name;
39
        $this->postCode  = $postCode;
40 1
    }
41
42 1
    public function getCountryId(): int
43
    {
44
        return $this->countryId;
45
    }
46
47
    public function setCountryId(int $countryId): void
48
    {
49
        $this->countryId = $countryId;
50 1
    }
51
52 1
    public function getName(): ?string
53
    {
54
        return $this->name;
55
    }
56
57
    public function setName(?string $name): void
58
    {
59
        $this->name = $name;
60 1
    }
61
62 1
    public function getPostCode(): ?string
63
    {
64
        return $this->postCode;
65 1
    }
66
67 1
    public function setPostCode(?string $postCode): void
68
    {
69
        $this->postCode = $postCode;
70 1
    }
71
72 1
    public function getType(): ?string
73
    {
74
        return $this->type;
75 1
    }
76
77 1
    public function setType(?string $type): void
78
    {
79
        $this->type = $type;
80 1
    }
81
82 1
    public function getMunicipality(): ?string
83
    {
84
        return $this->municipality;
85 1
    }
86
87 1
    public function setMunicipality(?string $municipality): void
88
    {
89
        $this->municipality = $municipality;
90
    }
91
92
    /**
93
     * @return array<string,string|int|null>
94
     */
95
    public function toArray(): array
96
    {
97
        return [
98
            Property::COUNTRY_ID->value => $this->countryId,
99
            Property::NAME->value       => $this->name,
100
            Property::POST_CODE->value  => $this->postCode
101
        ];
102
    }
103
}
104