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

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

Severity

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 dmank\gearman;
4
5
class Client
6
{
7
    /**
8
     * @var \GearmanClient
9
     */
10
    private $realClient;
11
    /**
12
     * @var ServerCollection
13
     */
14
    private $serverCollection;
15
16
    /**
17
     * @var bool
18
     */
19
    private $serverAddedToClient = false;
20
21
    const PRIORITY_LOW = 0;
22
    const PRIORITY_NORMAL = 1;
23
    const PRIORITY_HIGH = 2;
24
25
    /**
26
     * @param ServerCollection $servers
27
     */
28 10
    public function __construct(ServerCollection $servers)
29
    {
30 10
        $this->serverCollection = $servers;
31 10
    }
32
33
    /**
34
     * @param \GearmanClient $client
35
     */
36 9
    public function setImplementation(\GearmanClient $client)
37
    {
38 9
        $this->realClient = $client;
39 9
    }
40
41 1
    public function getJobStatus($jobHandle)
42
    {
43 1
        $status = $this->getClient()->jobStatus($jobHandle);
44
45 1
        return new JobStatus($status);
46
    }
47
48
    /**
49
     * @param     $method
50
     * @param     $workLoad
51
     * @param int $priority
52
     * @return mixed
53
     */
54 3
    public function executeInBackground($method, $workLoad, $priority = self::PRIORITY_LOW)
55
    {
56 3
        if (!StringHelper::isSerialized($workLoad)) {
57 3
            $workLoad = serialize($workLoad);
58 3
        }
59
60
        switch ($priority) {
61 3
            case self::PRIORITY_HIGH:
62 1
                $result = $this->getClient()->doHighBackground($method, $workLoad);
63 1
                break;
64 2
            case self::PRIORITY_NORMAL:
65 1
                $result = $this->getClient()->doBackground($method, $workLoad);
66 1
                break;
67 1
            case self::PRIORITY_LOW:
68 1
            default:
69 1
                $result = $this->getClient()->doLowBackground($method, $workLoad);
70 1
                break;
71
        }
72
73 3
        return $result;
74
    }
75
76
77
    /**
78
     * @param     $method
79
     * @param     $workLoad
80
     * @param int $priority
81
     * @return string
82
     */
83 4
    public function executeJob($method, $workLoad, $priority = self::PRIORITY_LOW)
84
    {
85 4
        if (!StringHelper::isSerialized($workLoad)) {
86 4
            $workLoad = serialize($workLoad);
87 4
        }
88
89 4
        $client = $this->getClient();
90
91
        switch ($priority) {
92 4
            case self::PRIORITY_HIGH:
93 1
                $result = $client->doHigh($method, $workLoad);
94 1
                break;
95 3
            case self::PRIORITY_NORMAL:
96 1
                $gearmanMethod = $this->getPriorityNormalMethod();
97 1
                $result = $client->$gearmanMethod($method, $workLoad);
98 1
                break;
99 2
            case self::PRIORITY_LOW:
100 2
            default:
101 2
                $result = $client->doLow($method, $workLoad);
102 2
                break;
103
        }
104
105 4
        return $result;
106
    }
107
108
    /**
109
     * @param array $jobs Array of dmank\gearman\Job, jobs to do
110
     * @param int $priority
111
     * @return array
112
     */
113 1
    public function executeJobs(array $jobs, $priority = self::PRIORITY_LOW)
0 ignored issues
show
The parameter $priority is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
114
    {
115 1
        $client = $this->getClient();
116
117 1
        $results = [];
118 1
        $client->setCompleteCallback(function ($task) use (&$results) {
119
            $results[] = $task->data();
120 1
        });
121
122 1
        foreach ($jobs as $job) {
123 1
            if (!is_a($job, Job::class)) {
124 1
                continue;
125
            }
126
127 1
            $client->addTask($job->getJobName(), $job->getWorkLoad());
128 1
        }
129
130 1
        $client->runTasks();
131
132 1
        return $results;
133
    }
134
135
    /**
136
     * @return \GearmanClient
137
     */
138 9
    private function getClient()
139
    {
140 9
        if (!$this->realClient) {
141
            $this->realClient = $this->createClient();
142
        }
143
144 9
        if (!$this->serverAddedToClient) {
145
            /* @var Server $server */
146 9
            foreach ($this->serverCollection->getServers() as $server) {
147 2
                $this->realClient->addServer($server->getHost(), $server->getPort());
148 9
            }
149
150 9
            $this->serverAddedToClient = true;
151 9
        }
152
153 9
        return $this->realClient;
154
    }
155
156
    /**
157
     * @return \GearmanClient
158
     */
159
    private function createClient()
160
    {
161
        return new \GearmanClient();
162
    }
163
164 1
    private function getPriorityNormalMethod()
165
    {
166 1
        $normalPriorityMethod = 'doLow';
167
168 1
        if (version_compare(phpversion('gearman'), '1.0.0') >= 0) {
169 1
            $normalPriorityMethod = 'doNormal';
170 1
        }
171
172 1
        return $normalPriorityMethod;
173
    }
174
}
175