Script::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Sokil\IsoCodes\Database\Scripts;
4
5
use Sokil\IsoCodes\Database\Scripts;
6
7
class Script
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 int
26
     */
27
    private $numericCode;
28
29
    /**
30
     * Script constructor.
31
     * @param string $name
32
     * @param string $alpha4
33
     * @param int $numericCode
34
     */
35
    public function __construct(
36
        $name,
37
        $alpha4,
38
        $numericCode
39
    ) {
40
        $this->name = $name;
41
        $this->alpha4 = $alpha4;
42
        $this->numericCode = $numericCode;
43
    }
44
45
46
    /**
47
     * @return string
48
     */
49
    public function getName()
50
    {
51
        return $this->name;
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getLocalName()
58
    {
59
        if ($this->localName === null) {
60
            $this->localName = dgettext(
61
                Scripts::getISONumber(),
62
                $this->name
63
            );
64
        }
65
66
        return $this->localName;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getAlpha4()
73
    {
74
        return $this->alpha4;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getNumericCode()
81
    {
82
        return $this->numericCode;
83
    }
84
}
85