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

Project::__construct()   A

Complexity

Conditions 5
Paths 16

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4555
c 0
b 0
f 0
cc 5
nc 16
nop 1
1
<?php
2
3
namespace LPTracker\models;
4
5
use LPTracker\exceptions\LPTrackerSDKException;
6
7
/**
8
 * Class Project
9
 * @package LPTracker\models
10
 */
11
class Project extends Model
12
{
13
14
    /**
15
     * @var integer
16
     */
17
    protected $id;
18
19
    /**
20
     * @var string
21
     */
22
    protected $name;
23
24
    /**
25
     * @var string
26
     */
27
    protected $page;
28
29
    /**
30
     * @var string
31
     */
32
    protected $domain;
33
34
35
    /**
36
     * Project constructor.
37
     *
38
     * @param array $projectData
39
     */
40
    public function __construct(array $projectData = [])
41
    {
42
        if (isset($projectData['id'])) {
43
            $this->id = $projectData['id'];
44
        }
45
        if (isset($projectData['name'])) {
46
            $this->name = $projectData['name'];
47
        }
48
        if (isset($projectData['page'])) {
49
            $this->page = $projectData['page'];
50
        }
51
        if (isset($projectData['domain'])) {
52
            $this->page = $projectData['domain'];
53
        }
54
    }
55
56
57
    /**
58
     * @return bool
59
     * @throws LPTrackerSDKException
60
     */
61
    public function validate()
62
    {
63
        if (empty($this->id)) {
64
            throw new LPTrackerSDKException('Project ID is required');
65
        }
66
        if (empty($this->name)) {
67
            throw new LPTrackerSDKException('Project name is required');
68
        }
69
70
        return true;
71
    }
72
73
74
    /**
75
     * @return array
76
     */
77
    public function toArray()
78
    {
79
        return [
80
            'id'     => $this->getId(),
81
            'name'   => $this->getName(),
82
            'page'   => $this->getPage(),
83
            'domain' => $this->getDomain()
84
        ];
85
    }
86
87
88
    /**
89
     * @return int
90
     */
91
    public function getId()
92
    {
93
        return intval($this->id);
94
    }
95
96
97
    /**
98
     * @return string
99
     */
100
    public function getName()
101
    {
102
        return $this->name;
103
    }
104
105
106
    /**
107
     * @return string
108
     */
109
    public function getPage()
110
    {
111
        return $this->page;
112
    }
113
114
115
    /**
116
     * @return string
117
     */
118
    public function getDomain()
119
    {
120
        return $this->domain;
121
    }
122
}