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.

CountryService::search()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 0
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\Connection\ConnectionInterface;
15
use Core23\SetlistFm\Exception\ApiException;
16
use Core23\SetlistFm\Exception\NotFoundException;
17
use Core23\SetlistFm\Model\CountrySearchResult;
18
19
final class CountryService
20
{
21
    /**
22
     * @var ConnectionInterface
23
     */
24
    private $connection;
25
26
    public function __construct(ConnectionInterface $connection)
27
    {
28
        $this->connection = $connection;
29
    }
30
31
    /**
32
     * Search for countries.
33
     *
34
     * @throws ApiException
35
     * @throws NotFoundException
36
     */
37
    public function search(): CountrySearchResult
38
    {
39
        $response = $this->connection->call('search/countries');
40
41
        if (!\array_key_exists('country', $response)) {
42
            return CountrySearchResult::createEmpty();
43
        }
44
45
        return CountrySearchResult::fromApi($response);
46
    }
47
}
48