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.
Completed
Push — master ( fc424a...ea923b )
by Christian
06:24
created

CountryService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A search() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\SetlistFm\Service;
13
14
use Core23\SetlistFm\Exception\ApiException;
15
use Core23\SetlistFm\Exception\NotFoundException;
16
use Core23\SetlistFm\Model\Country;
17
18
final class CountryService extends AbstractService
19
{
20
    /**
21
     * Search for countries.
22
     *
23
     * @throws ApiException
24
     * @throws NotFoundException
25
     *
26
     * @return Country[]
27
     */
28
    public function search(): array
29
    {
30
        $response = $this->call('search/countries');
31
32
        if (!array_key_exists('country', $response)) {
33
            return [];
34
        }
35
36
        return array_map(function ($data) {
37
            return Country::fromApi($data);
38
        }, $response['country']);
39
    }
40
}
41