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

LocalizeLanguagesClient::bestFit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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 View Code Duplication
    public function index(string $platform): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
}