Country   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 123
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 9
dl 0
loc 123
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getNumericCode() 0 3 1
A getAlpha2() 0 3 1
A getWithdrawalDate() 0 3 1
A __construct() 0 14 1
A getLocalName() 0 10 2
A getAlpha4() 0 3 1
A getAlpha3() 0 3 1
1
<?php
2
3
namespace Sokil\IsoCodes\Database\HistoricCountries;
4
5
use Sokil\IsoCodes\Database\HistoricCountries;
6
7
class Country
8
{
9
    /**
10
     * @var string
11
     */
12
    private $name;
13
14
    /**
15
     * @var string
16
     */
17
    private $localName;
18
19
    /**
20
     * @var string
21
     */
22
    private $alpha4;
23
24
    /**
25
     * @var string
26
     */
27
    private $alpha3;
28
29
    /**
30
     * @var string
31
     */
32
    private $alpha2;
33
34
    /**
35
     * @var string
36
     */
37
    private $withdrawalDate;
38
39
    /**
40
     * @var int|null
41
     */
42
    public $numericCode;
43
44
    /**
45
     * Country constructor.
46
     * @param string $name
47
     * @param string $alpha4
48
     * @param string $alpha3
49
     * @param string $alpha2
50
     * @param string $withdrawalDate
51
     * @param int|null $numericCode
52
     */
53
    public function __construct(
54
        $name,
55
        $alpha4,
56
        $alpha3,
57
        $alpha2,
58
        $withdrawalDate,
59
        $numericCode = null
60
    ) {
61
        $this->name = $name;
62
        $this->alpha4 = $alpha4;
63
        $this->alpha3 = $alpha3;
64
        $this->alpha2 = $alpha2;
65
        $this->withdrawalDate = $withdrawalDate;
66
        $this->numericCode = $numericCode;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getName()
73
    {
74
        return $this->name;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getLocalName()
81
    {
82
        if ($this->localName === null) {
83
            $this->localName = dgettext(
84
                HistoricCountries::getISONumber(),
85
                $this->name
86
            );
87
        }
88
89
        return $this->localName;
90
    }
91
92
    /**
93
     * @return string
94
     */
95
    public function getAlpha4()
96
    {
97
        return $this->alpha4;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    public function getAlpha3()
104
    {
105
        return $this->alpha3;
106
    }
107
108
    /**
109
     * @return string
110
     */
111
    public function getAlpha2()
112
    {
113
        return $this->alpha2;
114
    }
115
116
    /**
117
     * @return string
118
     */
119
    public function getWithdrawalDate()
120
    {
121
        return $this->withdrawalDate;
122
    }
123
124
    /**
125
     * @return int|null
126
     */
127
    public function getNumericCode()
128
    {
129
        return $this->numericCode;
130
    }
131
}
132