Country::getName()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace MusicBrainz;
4
5
/**
6
 * Class Country
7
 * @package MusicBrainz
8
 */
9
class Country
10
{
11
    /**
12
     * @todo Populate rest of the countries
13
     */
14
    private static $countries = array(
15
        'GB' => 'Great Britain',
16
    );
17
18
    /**
19
     * Get the country name for a MusicBrainz country code
20
     *
21
     * @static
22
     *
23
     * @param $countryCode
24
     *
25
     * @throws \OutOfBoundsException
26
     * @return bool
27
     */
28
    public static function getName($countryCode)
29
    {
30
        if (!isset(self::$countries[$countryCode])) {
31
            throw new \OutOfBoundsException(
32
                sprintf(
33
                    "Could not find corresponding country name for the country code %s",
34
                    $countryCode
35
                )
36
            );
37
        }
38
39
        return self::$countries[$countryCode];
40
    }
41
}
42