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.

Project::__construct()   A
last analyzed

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
class Project extends Model
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $id;
13
14
    /**
15
     * @var string
16
     */
17
    protected $name;
18
19
    /**
20
     * @var string
21
     */
22
    protected $page;
23
24
    /**
25
     * @var string
26
     */
27
    protected $domain;
28
29
    public function __construct(array $projectData = [])
30
    {
31
        if (isset($projectData['id'])) {
32
            $this->id = (int) $projectData['id'];
33
        }
34
        if (isset($projectData['name'])) {
35
            $this->name = $projectData['name'];
36
        }
37
        if (isset($projectData['page'])) {
38
            $this->page = $projectData['page'];
39
        }
40
        if (isset($projectData['domain'])) {
41
            $this->domain = $projectData['domain'];
42
        }
43
    }
44
45
    /**
46
     * @return bool
47
     * @throws LPTrackerSDKException
48
     */
49 View Code Duplication
    public function validate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    {
51
        if (empty($this->id)) {
52
            throw new LPTrackerSDKException('Project ID is required');
53
        }
54
55
        if (empty($this->name)) {
56
            throw new LPTrackerSDKException('Project name is required');
57
        }
58
59
        return true;
60
    }
61
62
    /**
63
     * @return array
64
     */
65
    public function toArray()
66
    {
67
        return [
68
            'id' => $this->getId(),
69
            'name' => $this->getName(),
70
            'page' => $this->getPage(),
71
            'domain' => $this->getDomain(),
72
        ];
73
    }
74
75
    /**
76
     * @return int
77
     */
78
    public function getId()
79
    {
80
        return $this->id;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getName()
87
    {
88
        return $this->name;
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function getPage()
95
    {
96
        return $this->page;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getDomain()
103
    {
104
        return $this->domain;
105
    }
106
}
107