CountryField   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 43
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 6 1
A Code() 0 4 1
A Name() 0 4 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