FindCountryRequest::getIsoAlpha2()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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