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 ( 0fa15b...4b090c )
by
unknown
15s
created

TwitterStatusUpdate::getApiEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\Twitter;
4
5
class TwitterStatusUpdate
6
{
7
    /** @var string */
8
    protected $content;
9
10
    /**
11
     * @var  array
12
     */
13
    private $imagePaths;
14
15
    /**
16
     * @var  array
17
     */
18
    public $imageIds;
19
20
    /**
21
     * @var  string
22
     */
23
    private $apiEndpoint = 'statuses/update';
24
25
    /*
26
     * @param  string $content
27
     */
28
    public function __construct(string $content, array $imagePaths = null)
29
    {
30
        $this->content = $content;
31
        $this->imagePaths = $imagePaths ? collect($imagePaths) : null;
0 ignored issues
show
Documentation Bug introduced by
It seems like $imagePaths ? collect($imagePaths) : null of type object<Illuminate\Support\Collection> or null is incompatible with the declared type array of property $imagePaths.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
32
    }
33
34
    /**
35
     * Get Twitter status update content.
36
     *
37
     * @return  string
38
     */
39
    public function getContent()
40
    {
41
        return $this->content;
42
    }
43
44
    /**
45
     * Get Twitter status update image paths.
46
     *
47
     * @return  string
48
     */
49
    public function getImagePaths()
50
    {
51
        return $this->imagePaths;
52
    }
53
54
    /**
55
     * Return Twitter status update api endpoint.
56
     * @return  string
57
     */
58
    public function getApiEndpoint()
59
    {
60
        return $this->apiEndpoint;
61
    }
62
63
    /**
64
     * Build Twitter request body.
65
     * @return  array
66
     */
67
    public function getRequestBody()
68
    {
69
        $body = [
70
            'status' => $this->getContent(),
71
        ];
72
73
        if ($this->imageIds) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->imageIds of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
74
            $body['media_ids'] = $this->imageIds->implode(',');
0 ignored issues
show
Bug introduced by
The method implode cannot be called on $this->imageIds (of type array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
75
        }
76
77
        return $body;
78
    }
79
}
80