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
Push — master ( 37a03c...579a75 )
by Casper
03:44 queued 01:41
created

ProposalsClient::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace NStack\Clients;
4
5
use NStack\Exceptions\FailedToParseException;
6
use NStack\Models\IpAddress;
7
use NStack\Models\Proposal;
8
use NStack\Models\ProposalDeleted;
0 ignored issues
show
Bug introduced by
The type NStack\Models\ProposalDeleted was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * Class ProposalsClient
12
 *
13
 * @package NStack\Clients
14
 * @author  Tiago Araujo <[email protected]>
15
 */
16
class ProposalsClient extends NStackClient
17
{
18
    /** @var string */
19
    protected $path = 'localize/proposals';
20
21
    /**
22
     * index
23
     *
24
     * @param String|null $guid
25
     * @return array
26
     * @throws FailedToParseException
27
     */
28 1
    public function index(String $guid = null): array
29
    {
30 1
        $response = $this->client->get($this->buildPath($this->path . '?guid=' . $guid));
31 1
        $contents = $response->getBody()->getContents();
32 1
        $data = json_decode($contents, true);
33
34 1
        $array = [];
35 1
        foreach ($data['data'] as $object) {
36 1
            $array[] = new Proposal($object);
37
        }
38
39 1
        return $array;
40
    }
41
42
    /**
43
     * store
44
     *
45
     * @param String|null $guid
46
     * @param String $key
47
     * @param String $value
48
     * @param String $platform
49
     * @param String $locale
50
     * @param String $section
51
     * @return Proposal
52
     * @throws FailedToParseException
53
     */
54 1
    public function store(
55
        String $guid,
56
        String $key,
57
        String $value,
58
        String $platform,
59
        String $locale,
60
        String $section
61
    )
62
    {
63 1
        $response = $this->client->post($this->buildPath($this->path), [
64
            'form_params' => [
65 1
                'key'       => $key,
66 1
                'value'     => $value,
67 1
                'locale'    => $locale,
68 1
                'platform'  => $platform,
69 1
                'guid'      => $guid,
70 1
                'section'   => $section,
71
            ]
72
        ]);
73 1
        $contents = $response->getBody()->getContents();
74 1
        $data = json_decode($contents, true);
75 1
        return new Proposal($data['data']);
76
    }
77
78
    /**
79
     * delete
80
     *
81
     * @param int $id
82
     * @param String $guid
83
     */
84
    public function delete(int $id, String $guid)
85
    {
86
        $this->client->delete($this->buildPath($this->path . '/' . $id . '?guid=' . $guid));
87
    }
88
89
}