Completed
Push — master ( ee94bf...c321ed )
by Mohamed
07:15
created

CountryField::setValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * CountryField is an object that hold a country locale details. It is callable from template files.
5
 *
6
 * @author  Mohamed Alsharaf <[email protected]>
7
 */
8
class CountryField extends ViewableData
9
{
10
    /**
11
     * Country code.
12
     *
13
     * @var string
14
     */
15
    protected $countryCode;
16
17
    /**
18
     * Set a country code.
19
     *
20
     * @param string $value
21
     *
22
     * @return CountryField
23
     */
24
    public function setValue($value)
25
    {
26
        $this->countryCode = $value;
27
28
        return $this;
29
    }
30
31
    /**
32
     * Get country code.
33
     *
34
     * @return string
35
     */
36
    public function Code()
37
    {
38
        return $this->countryCode;
39
    }
40
41
    /**
42
     * Get the country full name based on the code supplied to the object.
43
     *
44
     * @return string
45
     */
46
    public function Name()
47
    {
48
        return (string)Zend_Locale::getTranslation($this->Code(), 'country', i18n::get_locale());
49
    }
50
}
51