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 ( b21c26...dc2a23 )
by
unknown
21s queued 17s
created

Custom::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace LPTracker\models;
4
5
use LPTracker\exceptions\LPTrackerSDKException;
6
7
/**
8
 * Class Custom
9
 * @package LPTracker\models
10
 */
11
class Custom extends Model
12
{
13
14
    /**
15
     * @var integer
16
     */
17
    protected $id;
18
19
    /**
20
     * @var string
21
     */
22
    protected $type;
23
24
    /**
25
     * @var string
26
     */
27
    protected $name;
28
29
    /**
30
     * @var integer
31
     */
32
    protected $leadId;
33
34
    /**
35
     * @var mixed
36
     */
37
    protected $value;
38
39
40
    /**
41
     * Custom constructor.
42
     *
43
     * @param array   $customData
44
     * @param integer $leadId
45
     */
46
    public function __construct(array $customData = [], $leadId = 0)
47
    {
48
        if ( ! empty($customData['id'])) {
49
            $this->id = $customData['id'];
50
        }
51
        if ( ! empty($customData['type'])) {
52
            $this->type = $customData['type'];
53
        }
54
        if ( ! empty($customData['name'])) {
55
            $this->name = $customData['name'];
56
        }
57
        if ( ! empty($customData['value'])) {
58
            $this->value = $customData['value'];
59
        }
60
        if ($leadId > 0) {
61
            $this->leadId = $leadId;
62
        }
63
    }
64
65
66
    /**
67
     * @return array
68
     */
69
    public function toArray()
70
    {
71
        $result = [
72
            'id' => $this->id
73
        ];
74
75
        if ( ! empty($this->type)) {
76
            $result['type'] = $this->type;
77
        }
78
        if ( ! empty($this->name)) {
79
            $result['name'] = $this->name;
80
        }
81
        if ( ! empty($this->value)) {
82
            $result['value'] = $this->value;
83
        }
84
85
        return $result;
86
    }
87
88
89
    /**
90
     * @return bool
91
     * @throws LPTrackerSDKException
92
     */
93
    public function validate()
94
    {
95
        if (empty($this->id)) {
96
            throw new LPTrackerSDKException('Id is required');
97
        }
98
99
        return true;
100
    }
101
102
103
    /**
104
     * @return int
105
     */
106
    public function getId()
107
    {
108
        return intval($this->id);
109
    }
110
111
112
    /**
113
     * @return string
114
     */
115
    public function getType()
116
    {
117
        return $this->type;
118
    }
119
120
121
    /**
122
     * @return string
123
     */
124
    public function getName()
125
    {
126
        return $this->name;
127
    }
128
129
130
    /**
131
     * @param int $leadId
132
     *
133
     * @return $this
134
     */
135
    public function setLeadId($leadId)
136
    {
137
        $this->leadId = $leadId;
138
139
        return $this;
140
    }
141
142
143
    /**
144
     * @return int
145
     */
146
    public function getLeadId()
147
    {
148
        return $this->leadId;
149
    }
150
151
152
    /**
153
     * @return mixed
154
     */
155
    public function getValue()
156
    {
157
        return $this->value;
158
    }
159
160
161
    /**
162
     * @param mixed $value
163
     *
164
     * @return $this
165
     */
166
    public function setValue($value)
167
    {
168
        $this->value = $value;
169
170
        return $this;
171
    }
172
}