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

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.

Resource/Resource.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
namespace prgTW\BaseCRM\Resource;
4
5
use Doctrine\Common\Inflector\Inflector;
6
use prgTW\BaseCRM\Transport\Transport;
7
8
abstract class Resource extends BaseResource
9
{
10
	/** @var \Resource[] */
11
	protected $subResources = [];
12
13
	/** @var Transport */
14
	protected $transport;
15
16
	/** @var string */
17
	protected $uri;
18
19
	/**
20
	 * @param Transport $transport
21
	 * @param string    $uri
22
	 * @param array     $data
23
	 */
24
	public function __construct(Transport $transport, $uri, array $data = [])
25
	{
26
		$this->transport = $transport;
27
		$this->uri       = $uri;
28
		if ([] !== $data)
29
		{
30
			$this->hydrate($data);
31
		}
32
33
		$this->init();
34
	}
35
36
	/**
37
	 * @return string
38
	 */
39
	abstract protected function getEndpoint();
40
41
	protected function init()
42
	{
43
44
	}
45
46
	/**
47
	 * @param string $suffix
48
	 *
49
	 * @return string
50
	 */
51
	protected function getFullUri($suffix = '')
52
	{
53
		return sprintf('%s/%s/%s%s', static::getEndpoint(), static::PREFIX, $this->uri, $suffix);
54
	}
55
56
	/**
57
	 * @param string $name
58
	 *
59
	 * @return Resource|\Resource[]
60
	 */
61
	public function getSubResources($name = null)
62
	{
63
		if (isset($name))
64
		{
65
			return isset($this->subResources[$name]) ? $this->subResources[$name] : null;
66
		}
67
68
		return $this->subResources;
69
	}
70
71
	/**
72
	 * @param string[] $resourceClassNames
73
	 *
74
	 * @throws \InvalidArgumentException when class name is not a Resource
75
	 */
76
	protected function setSubResources(array $resourceClassNames)
77
	{
78
		foreach ($resourceClassNames as $key => $value)
79
		{
80
			$resourceClassName = is_int($key) ? $value : $key;
81
			if (false === is_subclass_of($resourceClassName, Resource::class))
0 ignored issues
show
Due to PHP Bug #53727, is_subclass_of might return inconsistent results on some PHP versions if \prgTW\BaseCRM\Resource\Resource::class can be an interface. If so, you could instead use ReflectionClass::implementsInterface.
Loading history...
82
			{
83
				//@codeCoverageIgnoreStart
84
				throw new \InvalidArgumentException(sprintf('Class %s is not an instance of %s', $resourceClassName, Resource::class));
85
				//@codeCoverageIgnoreEnd
86
			}
87
			$resourceName = $this->getResourceName($resourceClassName);
88
			$uri          = ltrim(sprintf('%s/%s', $this->uri, $resourceName), '/');
89
			if (false === is_int($key))
90
			{
91
				$uri = $value;
92
			}
93
94
			$class = new $resourceClassName($this->transport, $uri);
95
96
			$this->subResources[lcfirst(Inflector::camelize($resourceName))] = $class;
97
		}
98
	}
99
100
	/**
101
	 * @param array  $params
102
	 * @param string $instanceClassName
103
	 * @param string $idParam
104
	 *
105
	 * @return Resource
106
	 */
107
	protected function getObjectFromArray(array $params, $instanceClassName = null, $idParam = 'id')
108
	{
109
		if (null === $instanceClassName)
110
		{
111
			$instanceClassName = Inflector::singularize(static::class);
112
		}
113
114
		if (array_key_exists($idParam, $params))
115
		{
116
			$uri = sprintf('%s/%s', $this->uri, $params[$idParam]);
117
		}
118
		else
119
		{
120
			$uri = $this->uri;
121
		}
122
123
		return new $instanceClassName($this->transport, $uri, $params);
124
	}
125
126
	/**
127
	 * @param $method
128
	 * @param $arguments
129
	 *
130
	 * @return Resource|ResourceCollection
131
	 * @throws \BadMethodCallException
132
	 */
133
	public function __call($method, $arguments)
134
	{
135
		if ('get' !== substr($method, 0, 3))
136
		{
137
			//@codeCoverageIgnoreStart
138
			throw new \BadMethodCallException('Unknown resource');
139
			//@codeCoverageIgnoreEnd
140
		}
141
142
		$key         = lcfirst(substr($method, 3));
143
		$subResource = $this->getSubResources($key);
144
		if (null === $subResource)
145
		{
146
			//@codeCoverageIgnoreStart
147
			throw new \BadMethodCallException(sprintf('Resource "%s" not found', $key));
148
			//@codeCoverageIgnoreEnd
149
		}
150
151
		return $subResource;
152
	}
153
154
	/**
155
	 * @return Transport
156
	 */
157
	public function getTransport()
158
	{
159
		return $this->transport;
160
	}
161
}
162