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.
Passed
Push — master ( d9c91f...37a03c )
by Casper
01:54 queued 11s
created

IpAddressesClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

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

2 Methods

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