GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Country::getCountries()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * Copyright 2016 Jan Eichhorn <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace ApaiIO\Configuration;
19
20
/**
21
 * Country validation and country listings according to the amazon api
22
 *
23
 * @author Jan Eichhorn <[email protected]>
24
 */
25
final class Country
26
{
27
    const AUSTRALIA = 'com.au';
28
    const BRAZIL = 'com.br';
29
    const CANADA = 'ca';
30
    const CHINA = 'cn';
31
    const FRANCE = 'fr';
32
    const GERMANY = 'de';
33
    const INDIA = 'in';
34
    const INTERNATIONAL = 'com';
35
    const ITALY = 'it';
36
    const JAPAN = 'co.jp';
37
    const MEXICO = 'com.mx';
38
    const SPAIN = 'es';
39
    const UNITED_KINGDOM = 'co.uk';
40
41
    /**
42
     * Possible countries
43
     * Important for the request endpoints
44
     *
45
     * @var array
46
     */
47
    private static $countryList = [
48
        self::AUSTRALIA,
49
        self::BRAZIL,
50
        self::CANADA,
51
        self::CHINA,
52
        self::FRANCE,
53
        self::GERMANY,
54
        self::INDIA,
55
        self::INTERNATIONAL,
56
        self::ITALY,
57
        self::JAPAN,
58
        self::MEXICO,
59
        self::SPAIN,
60
        self::UNITED_KINGDOM
61
    ];
62
63
    /**
64
     * Gets all possible countries
65
     *
66
     * @return array
67
     */
68 2
    public static function getCountries()
69
    {
70 2
        return self::$countryList;
71
    }
72
73
    /**
74
     * Checks if the given value is a valid country
75
     *
76
     * @param string $country
77
     *
78
     * @return boolean
79
     */
80 6
    public static function isValidCountry($country)
81
    {
82 6
        return in_array(strtolower($country), self::$countryList);
83
    }
84
}
85