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 (917)

Security Analysis    not enabled

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/Profiler/Profiler.php (1 issue)

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
/**
4
 * Nip Framework
5
 */
6
7
use Nip\Profiler\Adapters\AbstractAdapter;
8
use Nip\Profiler\Profile;
9
10
class Nip_Profiler
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
{
12
13
    public $enabled = false;
14
15
    public $profiles = [];
16
    public $runningProfiles = [];
17
    public $filterElapsedSecs = null;
18
    /**
19
     * @var AbstractAdapter[]
20
     */
21
    protected $writers = [];
22
23
    /**
24
     * Singleton
25
     *
26
     * @return Nip_Profiler
27
     */
28
    public static function instance()
29
    {
30
        static $instance;
31
        if (!($instance instanceof self)) {
32
            $instance = new self();
33
        }
34
35
        return $instance;
36
    }
37
38
    /**
39
     * @param bool $enabled
40
     * @return $this
41
     */
42
    public function setEnabled($enabled = false)
43
    {
44
        $this->enabled = (boolean)$enabled;
45
        return $this;
46
    }
47
48
    public function clear()
49
    {
50
        $this->profiles = [];
51
52
        return $this;
53
    }
54
55
56
    public function start($profileName = false)
57
    {
58
        if (!$this->checkEnabled()) {
59
            return;
60
        }
61
62
        $profileID = $this->newProfileID($profileName);
63
64
        $profile = $this->newProfile($profileID);
65
        $profile->setName($profileName);
66
67
        $this->profiles[$profileID] = $profile;
68
        $this->addRunningProces($profileID);
69
        return $profile;
70
    }
71
72
    public function checkEnabled()
73
    {
74
        return $this->enabled;
75
    }
76
77
    public function newProfileID($name)
78
    {
79
        if ($name) {
80
            return $name;
81
        }
82
        $profilesCount = count($this->getProfiles(null, true));
83
        return 'profile' . $profilesCount;
84
    }
85
86
    public function getProfiles($type = null, $showUnfinished = false)
87
    {
88
89
        $profiles = [];
90
        foreach ($this->profiles as $key => $profile) {
91
            if ($type === null) {
92
                $condition = true;
93
            } else {
94
                $condition = ($profile->type && $type);
95
            }
96
97
            if (($profile->hasEnded() || $showUnfinished) && $condition) {
98
                $profiles[$key] = $profile;
99
            }
100
        }
101
102
        if (empty($profiles)) {
103
            $profiles = false;
104
        }
105
106
        return $profiles;
107
    }
108
109
    public function newProfile($id)
110
    {
111
        return new Profile($id);
112
    }
113
114
    public function addRunningProces($profileID)
115
    {
116
        $this->runningProfiles[] = $profileID;
117
    }
118
119
    public function end($profileID = false)
120
    {
121
        $profileID = $this->endPreckeck($profileID);
122
        if ($profileID) {
123
            $profile = $this->endProfile($profileID);
124
            if ($this->applyFilters($profile)) {
125
                $this->outputWriters($profile);
126
            }
127
        }
128
        return;
129
    }
130
131
    protected function endPreckeck($profileID)
132
    {
133
        if (!$this->checkEnabled()) {
134
            return;
135
        }
136
137
        if ($profileID == false) {
138
            $profileID = $this->getLastRunningProces();
139
        }
140
        return $profileID;
141
    }
142
143
    public function getLastRunningProces()
144
    {
145
        return array_pop($this->runningProfiles);
146
    }
147
148
    public function endProfile($profileID)
149
    {
150
        $profile = $this->getProfile($profileID);
151
        $profile->end();
152
153
        $key = array_search($profileID, $this->runningProfiles);
154
        if (is_numeric($key)) {
155
            unset($this->runningProfiles[$key]);
156
        }
157
158
        return $profile;
159
    }
160
161
    public function getProfile($profileID)
162
    {
163
        if (is_object($profileID)) {
164
            return $profileID;
165
        }
166
167
        if (!array_key_exists($profileID, $this->profiles)) {
168
            trigger_error("Profile handle '$profileID' not found in profiler log.", E_USER_ERROR);
169
        }
170
171
        $profile = $this->profiles[$profileID];
172
173
        return $profile;
174
    }
175
176
    protected function applyFilters($profile)
177
    {
178
        return $this->secondsFilter($profile);
179
    }
180
181
    public function secondsFilter($profile)
182
    {
183
        if ($profile && null !== $this->filterElapsedSecs && $profile->getElapsedSecs() < $this->filterElapsedSecs) {
184
            $this->deleteProfile($profile);
185
            return false;
186
        }
187
        return true;
188
    }
189
190
    public function deleteProfile($profile)
191
    {
192
        if (!array_key_exists($profile->profileID, $this->profiles)) {
193
            trigger_error("Query handle '{$profile->profileID}' not found in profiler log.", E_USER_ERROR);
194
        }
195
        unset($this->profiles[$profile->profileID]);
196
        return;
197
    }
198
199
    public function outputWriters($profile)
200
    {
201
        foreach ($this->writers as $writer) {
202
            $writer->write($profile);
203
        }
204
    }
205
206
    public function lastProcessID()
207
    {
208
        end($this->profiles);
209
210
        return key($this->profiles);
211
    }
212
213
    public function setFilterElapsedSecs($minimumSeconds = null)
214
    {
215
        if (null === $minimumSeconds) {
216
            $this->filterElapsedSecs = null;
217
        } else {
218
            $this->filterElapsedSecs = (integer)$minimumSeconds;
219
        }
220
221
        return $this;
222
    }
223
224
    /**
225
     * @param AbstractAdapter $writer
226
     */
227
    public function addWriter(AbstractAdapter $writer)
228
    {
229
        $this->writers[] = $writer;
230
    }
231
232
    /**
233
     * @param $name
234
     * @return AbstractAdapter
235
     */
236
    public function newWriter($name)
237
    {
238
        $class = $this->newWriterClass($name);
239
        $writer = new $class();
240
        return $writer;
241
    }
242
243
    /**
244
     * @param $name
245
     * @return string
246
     */
247
    public function newWriterClass($name)
248
    {
249
        return 'Nip\Profiler\Adapters\\' . ucfirst($name);
250
    }
251
}
252