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 ( 2c32a2...b98093 )
by
unknown
03:55
created

CustomField   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 14
lcom 1
cbo 2
dl 0
loc 99
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
F __construct() 0 43 11
A toArray() 0 15 1
A validate() 0 8 2
1
<?php
2
3
namespace LPTracker\models;
4
5
6
use LPTracker\exceptions\LPTrackerSDKException;
7
8
class CustomField extends Model
9
{
10
11
    protected $id;
12
13
    protected $projectId;
14
15
    protected $name;
16
17
    protected $type;
18
19
    protected $showInLeads;
20
21
    protected $showInDeals;
22
23
    protected $isMultiSelect;
24
25
    protected $isRequired;
26
27
    protected $description;
28
29
    protected $isMultiLine;
30
31
    public function __construct(array $data = [])
32
    {
33
        if (isset($data['id'])) {
34
            $this->id = $data['id'];
35
        }
36
37
        if (isset($data['project_id'])) {
38
            $this->projectId = $data['project_id'];
39
        }
40
41
        if (isset($data['name'])) {
42
            $this->name = $data['name'];
43
        }
44
45
        if (isset($data['type'])) {
46
            $this->type = $data['type'];
47
        }
48
49
        if (isset($data['show_in_leads'])) {
50
            $this->showInLeads = $data['show_in_leads'];
51
        }
52
53
        if (isset($data['show_in_deals'])) {
54
            $this->showInDeals = $data['show_in_deals'];
55
        }
56
57
        if (isset($data['is_multi_select'])) {
58
            $this->isMultiSelect = $data['is_multi_select'];
59
        }
60
61
        if (isset($data['is_required'])) {
62
            $this->isRequired = $data['is_required'];
63
        }
64
65
        if (isset($data['description'])) {
66
            $this->description = $data['description'];
67
        }
68
69
        if (isset($data['is_multi_line'])) {
70
            $this->isMultiLine = $data['is_multi_line'];
71
        }
72
73
    }
74
75
    /**
76
     * @return array
77
     */
78
    public function toArray()
79
    {
80
        return [
81
            'id'              => $this->id,
82
            'project_id'      => $this->projectId,
83
            'name'            => $this->name,
84
            'type'            => $this->type,
85
            'show_in_leads'   => $this->showInLeads,
86
            'show_in_deals'   => $this->showInDeals,
87
            'is_multi_select' => $this->isMultiSelect,
88
            'is_required'     => $this->isRequired,
89
            'description'     => $this->description,
90
            'is_multi_line'   => $this->isMultiLine
91
        ];
92
    }
93
94
    /**
95
     * @return bool
96
     * @throws LPTrackerSDKException
97
     */
98
    public function validate()
99
    {
100
        if (empty($this->id)) {
101
            throw new LPTrackerSDKException('Id is required');
102
        }
103
104
        return true;
105
    }
106
}