Currency::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
1
<?php
2
3
namespace Sokil\IsoCodes\Database\Currencies;
4
5
use Sokil\IsoCodes\Database\Currencies;
6
7
class Currency
8
{
9
    /**
10
     * @var string
11
     */
12
    private $letterCode;
13
14
    /**
15
     * @var int
16
     */
17
    private $numericCode;
18
19
    /**
20
     * @var string
21
     */
22
    private $name;
23
24
    /**
25
     * @var string
26
     */
27
    private $localName;
28
29
    /**
30
     * @param string $name
31
     * @param string $letterCode
32
     * @param int $numericCode
33
     */
34
    public function __construct(
35
        $name,
36
        $letterCode,
37
        $numericCode
38
    ) {
39
        $this->name = $name;
40
        $this->letterCode = $letterCode;
41
        $this->numericCode = $numericCode;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getName()
48
    {
49
        return $this->name;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getLocalName()
56
    {
57
        if ($this->localName === null) {
58
            $this->localName = dgettext(
59
                Currencies::getISONumber(),
60
                $this->name
61
            );
62
        }
63
64
        return $this->localName;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getLetterCode()
71
    {
72
        return $this->letterCode;
73
    }
74
75
    /**
76
     * @return int
77
     */
78
    public function getNumericCode()
79
    {
80
        return $this->numericCode;
81
    }
82
}
83