Country   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCountries() 0 4 1
A isValidCountry() 0 6 2
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
 * Countryvalidation and countrylistings according to the amazonapi
22
 *
23
 * @author Jan Eichhorn <[email protected]>
24
 */
25
final class Country
26
{
27
    /**
28
     * Possible countries
29
     * Important for the requestendpoints
30
     *
31
     * @var array
32
     */
33
    private static $countryList = [
34
        'de',
35
        'com',
36
        'co.uk',
37
        'ca',
38
        'fr',
39
        'co.jp',
40
        'it',
41
        'cn',
42
        'es',
43
        'in',
44
        'com.br',
45
        'com.mx',
46
        'com.au'
47
    ];
48
49
    /**
50
     * Gets all possible countries
51
     *
52
     * @return array
53
     */
54 2
    public static function getCountries()
55
    {
56 2
        return self::$countryList;
57
    }
58
59
    /**
60
     * Checks if the given value is a valid country
61
     *
62
     * @param string  $country
63
     *
64
     * @return boolean
65
     */
66 6
    public static function isValidCountry($country)
67
    {
68 6
        $isValid = in_array(strtolower($country), self::$countryList) ? true : false;
69
70 6
        return $isValid;
71
    }
72
}
73