Completed
Push — master ( 519fda...980905 )
by Mohamed
04:24
created

CountryField::Code()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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 1
    public function setValue($value)
25
    {
26 1
        $this->countryCode = $value;
27
28 1
        return $this;
29
    }
30
31
    /**
32
     * Get country code.
33
     *
34
     * @return string
35
     */
36 1
    public function Code()
37
    {
38 1
        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 1
    public function Name()
47
    {
48 1
        return (string) Zend_Locale::getTranslation($this->Code(), 'country', i18n::get_locale());
49
    }
50
}
51