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.
Failed Conditions
Branch master (37a03c)
by Casper
02:30
created

LocalizeLanguagesClient::index()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 12
rs 10
ccs 8
cts 8
cp 1
crap 2
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
}