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.

Issues (46)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/LPTracker/models/Contact.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace LPTracker\models;
4
5
use LPTracker\exceptions\LPTrackerSDKException;
6
7
class Contact extends Model
8
{
9
    /**
10
     * @var integer
11
     */
12
    protected $id;
13
14
    /**
15
     * @var integer
16
     */
17
    protected $projectId;
18
19
    /**
20
     * @var string
21
     */
22
    protected $name;
23
24
    /**
25
     * @var string
26
     */
27
    protected $profession;
28
29
    /**
30
     * @var string
31
     */
32
    protected $site;
33
34
    /**
35
     * @var ContactDetail[]
36
     */
37
    protected $details = [];
38
39
    /**
40
     * @var ContactField[]
41
     */
42
    protected $fields = [];
43
44
    public function __construct(array $contactData = [])
45
    {
46
        if (!empty($contactData['id'])) {
47
            $this->id = (int) $contactData['id'];
48
        }
49
        if (!empty($contactData['project_id'])) {
50
            $this->projectId = (int) $contactData['project_id'];
51
        }
52
        if (!empty($contactData['name'])) {
53
            $this->name = $contactData['name'];
54
        }
55
        if (!empty($contactData['profession'])) {
56
            $this->profession = $contactData['profession'];
57
        }
58
        if (!empty($contactData['site'])) {
59
            $this->site = $contactData['site'];
60
        }
61 View Code Duplication
        if (!empty($contactData['details']) && is_array($contactData['details'])) {
0 ignored issues
show
This code seems to be duplicated across 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...
62
            foreach ($contactData['details'] as $detail) {
63
                $detail['contact_id'] = $this->id;
64
                $detailModel = new ContactDetail($detail);
65
                $this->addDetail($detailModel);
66
            }
67
        }
68 View Code Duplication
        if (!empty($contactData['fields']) && is_array($contactData['fields'])) {
0 ignored issues
show
This code seems to be duplicated across 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...
69
            foreach ($contactData['fields'] as $fieldData) {
70
                $fieldData['contact_id'] = $this->id;
71
                $fieldModel = new ContactField($fieldData);
72
                $this->addField($fieldModel);
73
            }
74
        }
75
    }
76
77
    /**
78
     * @return bool
79
     * @throws LPTrackerSDKException
80
     */
81
    public function validate()
82
    {
83
        if (empty($this->id) && empty($this->projectId)) {
84
            throw new LPTrackerSDKException('Project ID or Contact ID is required');
85
        }
86
87
        if (empty($this->details)) {
88
            throw new LPTrackerSDKException('The contact does not have valid detail');
89
        }
90
91
        foreach ($this->details as $detail) {
92
            if (!$detail->validate()) {
93
                throw new LPTrackerSDKException('The contact does not have valid detail');
94
            }
95
        }
96
        return true;
97
    }
98
99
    /**
100
     * @return array
101
     */
102
    public function toArray()
103
    {
104
        $result = [
105
            'project_id' => $this->getProjectId(),
106
            'details' => [],
107
        ];
108
        if (!empty($this->id)) {
109
            $result['id'] = $this->getId();
110
        }
111
        if (!empty($this->name)) {
112
            $result['name'] = $this->getName();
113
        }
114
        if (!empty($this->profession)) {
115
            $result['profession'] = $this->getProfession();
116
        }
117
        if (!empty($this->site)) {
118
            $result['site'] = $this->getSite();
119
        }
120
        foreach ($this->getDetails() as $detail) {
121
            $result['details'][] = $detail->toArray();
122
        }
123
        foreach ($this->getFields() as $field) {
124
            $result['fields'][$field->getId()] = $field->getValue();
125
        }
126
        return $result;
127
    }
128
129
    /**
130
     * @return int
131
     */
132
    public function getId()
133
    {
134
        return (int) $this->id;
135
    }
136
137
    /**
138
     * @return int
139
     */
140
    public function getProjectId()
141
    {
142
        return (int) $this->projectId;
143
    }
144
145
    /**
146
     * @return string
147
     */
148
    public function getName()
149
    {
150
        return $this->name;
151
    }
152
153
    /**
154
     * @param string $name
155
     * @return $this
156
     */
157
    public function setName($name)
158
    {
159
        $this->name = $name;
160
        return $this;
161
    }
162
163
    /**
164
     * @return string
165
     */
166
    public function getProfession()
167
    {
168
        return $this->profession;
169
    }
170
171
    /**
172
     * @param string $profession
173
     * @return $this
174
     */
175
    public function setProfession($profession)
176
    {
177
        $this->profession = $profession;
178
        return $this;
179
    }
180
181
    /**
182
     * @return string
183
     */
184
    public function getSite()
185
    {
186
        return $this->site;
187
    }
188
189
    /**
190
     * @param string $site
191
     * @return $this
192
     */
193
    public function setSite($site)
194
    {
195
        $this->site = $site;
196
        return $this;
197
    }
198
199
    /**
200
     * @return ContactDetail[]
201
     */
202
    public function getDetails()
203
    {
204
        return $this->details;
205
    }
206
207
    /**
208
     * @param ContactDetail[] $details
209
     * @return $this
210
     */
211
    public function setDetails(array $details)
212
    {
213
        foreach ($details as $detail) {
214
            $detail->validate();
215
        }
216
        $this->details = $details;
217
        return $this;
218
    }
219
220
    /**
221
     * @param ContactDetail $detail
222
     * @return $this
223
     */
224
    public function addDetail(ContactDetail $detail)
225
    {
226
        $detail->validate();
227
        $this->details[] = $detail;
228
        return $this;
229
    }
230
231
    /**
232
     * @return ContactField[]
233
     */
234
    public function getFields()
235
    {
236
        return $this->fields;
237
    }
238
239
    /**
240
     * @param ContactField[] $fields
241
     * @return $this
242
     */
243
    public function setFields(array $fields)
244
    {
245
        foreach ($fields as $field) {
246
            $field->validate();
247
        }
248
        $this->fields = $fields;
249
        return $this;
250
    }
251
252
    /**
253
     * @param ContactField $field
254
     * @return $this
255
     */
256
    public function addField(ContactField $field)
257
    {
258
        $field->validate();
259
        $this->fields[] = $field;
260
        return $this;
261
    }
262
}
263