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.
Completed
Push — master ( 39c4f8...de6395 )
by Dirk
05:18 queued 02:45
created

Pins::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 4
Bugs 2 Features 1
Metric Value
c 4
b 2
f 1
dl 0
loc 5
ccs 2
cts 4
cp 0.5
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
crap 1.125
1
<?php
2
/**
3
 * Copyright 2015 Dirk Groenen
4
 *
5
 * (c) Dirk Groenen <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace DirkGroenen\Pinterest\Endpoints;
12
13
use DirkGroenen\Pinterest\Models\Pin;
14
use DirkGroenen\Pinterest\Models\Collection;
15
16
class Pins extends Endpoint {
17
18
    /**
19
     * Get a pin object
20
     *
21
     * @access public
22
     * @param  string   $pin_id
23
     * @param array     $data
24
     * @throws Exceptions/PinterestExceptions
25
     * @return Pin
26
     */
27 3
    public function get($pin_id, array $data = [])
28
    {
29 3
        $response = $this->request->get(sprintf("pins/%s", $pin_id), $data);
30 3
        return new Pin($this->master, $response);
0 ignored issues
show
Documentation introduced by
$response is of type object<DirkGroenen\Pinterest\Transport\Response>, but the function expects a array|object<DirkGroenen...ransport\Response>|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
    }
32
33
    /**
34
     * Get all pins from the given board
35
     *
36
     * @access public
37
     * @param  string   $board_id
38
     * @param array     $data
39
     * @throws Exceptions/PinterestExceptions
40
     * @return Collection
41
     */
42 1
    public function fromBoard($board_id, array $data = [])
43
    {
44 1
        $response = $this->request->get(sprintf("boards/%s/pins", $board_id), $data);
45 1
        return new Collection($this->master, $response, "Pin");
46
    }
47
48
    /**
49
     * Create a pin
50
     *
51
     * @access public
52
     * @param  array    $data
53
     * @throws Exceptions/PinterestExceptions
54
     * @return Pin
55
     */
56 1
    public function create(array $data)
57
    {
58 1
        if (array_key_exists("image", $data)) {
59
            if (class_exists("\CURLFile")) {
60
                $data["image"] = new \CURLFile($data['image']);
61
            } else {
62
                $data["image"] = '@' . $data['image'];
63
            }
64
        }
65
66 1
        $response = $this->request->post("pins", $data);
67 1
        return new Pin($this->master, $response);
0 ignored issues
show
Documentation introduced by
$response is of type object<DirkGroenen\Pinterest\Transport\Response>, but the function expects a array|object<DirkGroenen...ransport\Response>|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
68
    }
69
70
    /**
71
     * Update a pin
72
     *
73
     * @access public
74
     * @param  string   $pin_id
75
     * @param  array    $data
76
     * @throws Exceptions/PinterestExceptions
77
     * @return Pin
78
     */
79 1
    public function update($pin_id, array $data)
80 1
    {
81
        $response = $this->request->update(sprintf("pins/%s", $pin_id), $data);
82
        return new Pin($this->master, $response);
0 ignored issues
show
Documentation introduced by
$response is of type object<DirkGroenen\Pinterest\Transport\Response>, but the function expects a array|object<DirkGroenen...ransport\Response>|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
83
    }
84
85
    /**
86
     * Delete a pin
87
     *
88
     * @access public
89
     * @param  string   $pin_id
90
     * @throws Exceptions/PinterestExceptions
91
     * @return boolean
92
     */
93 1
    public function delete($pin_id)
94
    {
95 1
        $this->request->delete(sprintf("pins/%s", $pin_id));
96 1
        return true;
97
    }
98
}