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/AutoLoader/AutoLoader.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 Nip\AutoLoader;
4
5
use Nip\AutoLoader\Exception as AutoloadException;
6
use Nip\AutoLoader\Loaders\AbstractLoader;
7
use Nip\AutoLoader\Loaders\ClassMap;
8
use Nip\AutoLoader\Loaders\Psr4Class;
9
10
/**
11
 * Class AutoLoader
12
 * @package Nip\AutoLoader
13
 */
14
class AutoLoader
15
{
16
17
    /**
18
     * @var bool
19
     */
20
    public static $splHandler = false;
21
22
    /**
23
     * @var AbstractLoader[]
24
     */
25
    protected $loaders = [];
26
27
    /**
28
     * @var string
29
     */
30
    protected $cachePath;
31
32
    /**
33
     * @var array
34
     */
35
    protected $ignoreTokens = [];
36
37
    /**
38
     * @param self $autoloader
39
     * @return bool
40
     * @throws Exception
41
     */
42 1
    public static function registerHandler($autoloader)
43
    {
44
        // Only register once per instance
45 1
        if (static::$splHandler) {
46
            return false;
47
        }
48
49 1
        if ($autoloader instanceof self) {
50 1
            return spl_autoload_register([$autoloader, 'autoload']);
51
        }
52
53
        throw new AutoloadException('Invalid AutoLoader specified in register handler');
54
    }
55
56
    /**
57
     * Singleton
58
     *
59
     * @return self
60
     */
61
    public static function instance()
62
    {
63
        static $instance;
64
        if (!($instance instanceof self)) {
65
            $instance = new self();
66
        }
67
68
        return $instance;
69
    }
70
71
    /**
72
     * @param $dir
73
     * @return $this
74
     */
75
    public function addDirectory($dir)
76
    {
77
        $this->getClassMapLoader()->addDirectory($dir);
78
79
        return $this;
80
    }
81
82
    /**
83
     * @return ClassMap
84
     */
85
    public function getClassMapLoader()
86
    {
87
        return $this->getLoader('ClassMap');
88
    }
89
90
    /**
91
     * @param $name
92
     * @return AbstractLoader
93
     */
94
    public function getLoader($name)
95
    {
96
        if (!$this->hasLoader($name)) {
97
            $this->initLoader($name);
98
        }
99
100
        return $this->loaders[$name];
101
    }
102
103
    /**
104
     * @param $name
105
     * @return bool
106
     */
107
    public function hasLoader($name)
108
    {
109
        return isset($this->loaders[$name]);
110
    }
111
112
    /**
113
     * @param $name
114
     */
115
    public function initLoader($name)
116
    {
117
        $loader = $this->newLoader($name);
118
        $this->addLoader($name, $loader);
119
    }
120
121
    /**
122
     * @param $name
123
     * @return AbstractLoader
124
     */
125
    public function newLoader($name)
126
    {
127
        $class = $this->getLoaderClass($name);
128
        $loader = new $class;
129
130
        return $loader;
131
    }
132
133
    /**
134
     * @param $name
135
     * @return string
136
     */
137
    public function getLoaderClass($name)
138
    {
139
        return 'Nip\AutoLoader\Loaders\\'.$name;
140
    }
141
142
    /**
143
     * @param $name
144
     * @param AbstractLoader $loader
145
     */
146
    public function addLoader($name, $loader)
147
    {
148
        $loader->setAutoLoader($this);
149
        $this->loaders[$name] = $loader;
150
    }
151
152
    /**
153
     * @param $prefix
154
     * @param $baseDir
155
     * @return $this
156
     */
157
    public function addNamespace($prefix, $baseDir)
158
    {
159
        $this->getPsr4ClassLoader()->addPrefix($prefix, $baseDir);
160
161
        return $this;
162
    }
163
164
    /**
165
     * @return Psr4Class
166
     */
167
    public function getPsr4ClassLoader()
168
    {
169
        return $this->getLoader('Psr4Class');
170
    }
171
172
    public function initLoaders()
173
    {
174
        $loaderNames = $this->getLoaderOrder();
175
        foreach ($loaderNames as $name) {
176
            $this->initLoader($name);
177
        }
178
    }
179
180
    /**
181
     * @return array
182
     */
183
    public function getLoaderOrder()
184
    {
185
        return ['Psr4', 'ClassMap'];
186
    }
187
188
    /**
189
     * @return mixed
190
     */
191
    public function getCachePath()
192
    {
193
        return $this->cachePath;
194
    }
195
196
    /**
197
     * @param $path
198
     * @return $this
199
     */
200
    public function setCachePath($path)
201
    {
202
        $this->cachePath = $path;
203
204
        return $this;
205
    }
206
207
    /**
208
     * @param $class
209
     * @return bool
210
     */
211
    public function isClass($class)
212
    {
213
        return is_file($this->getClassLocation($class));
214
    }
215
216
    /**
217
     * @param $class
218
     * @return null|string
219
     */
220
    public function getClassLocation($class)
221
    {
222
        $loaders = $this->getLoaders();
223
        foreach ($loaders as $loader) {
224
            $path = $loader->getClassLocation($class);
225
            if ($path) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $path of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
226
                return $path;
227
            }
228
        }
229
230
        return null;
231
    }
232
233
    /**
234
     * @return AbstractLoader[]
235
     */
236
    public function getLoaders()
237
    {
238
        return $this->loaders;
239
    }
240
241
    /**
242
     * @param $class
243
     * @return bool
244
     */
245
    public function autoload($class)
246
    {
247
        try {
248
            return $this->load($class);
249
        } catch (AutoloadException $ex) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
250
        }
251
252
        return false;
253
    }
254
255
    /**
256
     * @param $class
257
     * @return bool
258
     */
259
    public function load($class)
260
    {
261
        if ($this->hasIgnoreTokens($class)) {
262
            return true;
263
        }
264
265
        if (class_exists($class, false)) {
266
            return true;
267
        }
268
269
        $loaders = $this->getLoaders();
270
        foreach ($loaders as $loader) {
271
            if ($loader->load($class)) {
272
                return true;
273
            }
274
        }
275
276
        return false;
277
    }
278
279
    /**
280
     * @param $token
281
     * @return bool
282
     */
283
    public function hasIgnoreTokens($token)
284
    {
285
        return in_array($token, $this->ignoreTokens);
286
    }
287
288
    /**
289
     * @param $token
290
     */
291
    public function addIgnoreTokens($token)
292
    {
293
        $this->ignoreTokens[] = $token;
294
    }
295
296
    /**
297
     * @return array
298
     */
299
    public function getIgnoreTokens()
300
    {
301
        return $this->ignoreTokens;
302
    }
303
304
    /**
305
     * @param array $ignoreTokens
306
     */
307
    public function setIgnoreTokens($ignoreTokens)
308
    {
309
        $this->ignoreTokens = $ignoreTokens;
310
    }
311
}
312