Test Failed
Push — main ( 6b4729...30d39c )
by Vasil
04:06 queued 18s
created

FindStateRequest::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Location\State;
6
7
use VasilDakov\Speedy\Property;
8
9
/**
10
 * Class FindStateRequest.
11
 *
12
 * @author Vasil Dakov <[email protected]>
13
 * @copyright 2009-2022 Neutrino.bg
14
 *
15
 * @version 1.0
16
 */
17
class FindStateRequest
18
{
19
    private ?int $countryId;
20
21
    private ?string $name;
22
23
    public function __construct(int $countryId, ?string $name = null)
24
    {
25
        $this->countryId = $countryId;
26
        $this->name = $name;
27
    }
28
29
    /**
30
     * @param int|null $countryId
31
     */
32
    public function setCountryId(?int $countryId): void
33
    {
34
        $this->countryId = $countryId;
35
    }
36
37
    /**
38
     * @return int|null
39
     */
40
    public function getCountryId(): ?int
41
    {
42
        return $this->countryId;
43
    }
44
45
    /**
46
     * @param string|null $name
47
     */
48
    public function setName(?string $name): void
49
    {
50
        $this->name = $name;
51
    }
52
53
    /**
54
     * @return string|null
55
     */
56
    public function getName(): ?string
57
    {
58
        return $this->name;
59
    }
60
61
    /**
62
     * @return array<string,int|string|null>
63
     */
64
    public function toArray(): array
65
    {
66
        return [
67
            Property::COUNTRY_ID->value => $this->countryId,
68
            Property::NAME->value => $this->name,
69
        ];
70
    }
71
}
72