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.

CountriesClient   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 45
rs 10
ccs 13
cts 13
cp 1
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 14 2
A show() 0 9 1
1
<?php
2
3
namespace NStack\Clients;
4
5
use NStack\Models\Country;
6
7
/**
8
 * Class CountriesClient
9
 *
10
 * @package NStack\Clients
11
 * @author  Casper Rasmussen <[email protected]>
12
 */
13
class CountriesClient extends NStackClient
14
{
15
    /** @var string */
16
    protected $path = 'geographic/countries';
17
18
    /**
19
     * index
20
     *
21
     * @return array
22
     * @throws \NStack\Exceptions\FailedToParseException
23
     * @author Casper Rasmussen <[email protected]>
24
     */
25 1
    public function index(): array
26
    {
27 1
        $response = $this->client->get($this->buildPath($this->path));
28
29 1
        $contents = $response->getBody()->getContents();
30
31 1
        $data = json_decode($contents, true);
32
33 1
        $array = [];
34 1
        foreach ($data['data'] as $object) {
35 1
            $array[] = new Country($object);
36
        }
37
38 1
        return $array;
39
    }
40
41
    /**
42
     * show
43
     *
44
     * @param $id
45
     * @return \NStack\Models\Country
46
     * @throws \NStack\Exceptions\FailedToParseException
47
     * @author Casper Rasmussen <[email protected]>
48
     */
49 1
    public function show($id): Country
50
    {
51 1
        $response = $this->client->get($this->buildPath($this->path . '/' . $id));
52
53 1
        $contents = $response->getBody()->getContents();
54
55 1
        $data = json_decode($contents, true);
56
57 1
        return new Country($data['data']);
58
    }
59
}