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

TimezoneClient   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 59
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

3 Methods

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