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.

PushMessageDTO   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 0
dl 0
loc 118
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getAttributes() 0 4 1
A getData() 0 4 1
A getMessageId() 0 4 1
A getPublishTime() 0 4 1
A setAttributes() 0 6 1
A setData() 0 6 1
A setMessageId() 0 6 1
A setPublishTime() 0 6 1
1
<?php
2
3
namespace Ozean12\GooglePubSubBundle\DTO;
4
5
use JMS\Serializer\Annotation as Serializer;
6
7
/**
8
 * Class PushMessageDTO
9
 */
10
class PushMessageDTO
11
{
12
    /**
13
     * @Serializer\Type("array<string>")
14
     *
15
     * @var string[]
16
     */
17
    private $attributes;
18
19
    /**
20
     * @Serializer\Type("string")
21
     *
22
     * @var string
23
     */
24
    private $data;
25
26
    /**
27
     * @Serializer\Type("string")
28
     *
29
     * @var string
30
     */
31
    private $messageId;
32
33
    /**
34
     * @Serializer\Type("string")
35
     *
36
     * @var string
37
     */
38
    private $publishTime;
39
40
    /**
41
     * PushMessageDTO constructor.
42
     *
43
     * @param string   $data
44
     * @param string[] $attributes
45
     */
46
    public function __construct($data = null, array $attributes = null)
47
    {
48
        $this->attributes = $attributes;
0 ignored issues
show
Documentation Bug introduced by
It seems like $attributes can be null. However, the property $attributes is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

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

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
49
        $this->data = $data;
50
    }
51
52
    /**
53
     * @return string[]
54
     */
55
    public function getAttributes()
56
    {
57
        return $this->attributes;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getData()
64
    {
65
        return $this->data;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getMessageId()
72
    {
73
        return $this->messageId;
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    public function getPublishTime()
80
    {
81
        return $this->publishTime;
82
    }
83
84
    /**
85
     * @param string[] $attributes
86
     * @return PushMessageDTO
87
     */
88
    public function setAttributes(array $attributes)
89
    {
90
        $this->attributes = $attributes;
91
92
        return $this;
93
    }
94
95
    /**
96
     * @param string $data
97
     * @return PushMessageDTO
98
     */
99
    public function setData($data)
100
    {
101
        $this->data = $data;
102
103
        return $this;
104
    }
105
106
    /**
107
     * @param string $messageId
108
     * @return PushMessageDTO
109
     */
110
    public function setMessageId($messageId)
111
    {
112
        $this->messageId = $messageId;
113
114
        return $this;
115
    }
116
117
    /**
118
     * @param string $publishTime
119
     * @return PushMessageDTO
120
     */
121
    public function setPublishTime($publishTime)
122
    {
123
        $this->publishTime = $publishTime;
124
125
        return $this;
126
    }
127
}
128