FindCountryRequest   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 54
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setIsoAlpha2() 0 3 1
A getName() 0 3 1
A toArray() 0 6 1
A getIsoAlpha2() 0 3 1
A setName() 0 3 1
A getIsoAlpha3() 0 3 1
A setIsoAlpha3() 0 3 1
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