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
Branch master (37a03c)
by Casper
01:38
created

LocalizeLanguagesClient   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
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 39
rs 10
ccs 13
cts 13
cp 1
wmc 3

2 Methods

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