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

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/Service/Service.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 BlizzardApi\Service;
4
5
use BlizzardApi\BlizzardClient;
6
use GuzzleHttp\Client;
7
use Psr\Http\Message\ResponseInterface;
8
9
/**
10
 * Class Abstract Service
11
 *
12
 * @author Oleg Kachinsky <[email protected]>
13
 */
14
class Service
15
{
16
    /**
17
     * @var BlizzardClient $blizzardClient Configured blizzard client
18
     */
19
    protected $blizzardClient;
20
21
    /**
22
     * @var string $serviceParam Service parameter
23
     */
24
    protected $serviceParam;
25
26
    /**
27
     * Service constructor
28
     *
29
     * @param BlizzardClient $blizzardClient Configured blizzard client
30
     */
31
    public function __construct(BlizzardClient $blizzardClient)
32
    {
33
        $this->blizzardClient = $blizzardClient;
34
    }
35
36
    /**
37
     * Request
38
     *
39
     * Make request with API url and specific URL suffix
40
     *
41
     * @param string $urlSuffix API URL method
42
     * @param array  $options   Options
43
     *
44
     * @return ResponseInterface
45
     */
46
    protected function request($urlSuffix, array $options)
47
    {
48
        $client = new Client([
49
            'base_uri' => $this->blizzardClient->getApiUrl(),
50
        ]);
51
52
        $options = $this->generateQueryOptions($options);
53
54
        return $client->get($this->serviceParam.$urlSuffix, $options);
55
    }
56
57
    /**
58
     * Generate query options
59
     *
60
     * Setting default option to given options array if it does have 'query' key,
61
     * otherwise creating 'query' key with default options
62
     *
63
     * @param array $options
64
     *
65
     * @return array
66
     */
67
    private function generateQueryOptions(array $options = [])
68
    {
69
        if (isset($options['query'])) {
70
            $result = $options['query'] + $this->getDefaultOptions();
71
        } else {
72
            $result['query'] = $options + $this->getDefaultOptions();
0 ignored issues
show
Coding Style Comprehensibility introduced by
$result was never initialized. Although not strictly required by PHP, it is generally a good practice to add $result = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
73
        }
74
75
        return $result;
76
    }
77
78
    /**
79
     * Get default options
80
     *
81
     * Get default query options from configured Blizzard Client
82
     *
83
     * @return array
84
     */
85
    private function getDefaultOptions()
86
    {
87
        return [
88
            'locale' => $this->blizzardClient->getLocale(),
89
            'apiKey' => $this->blizzardClient->getApiKey(),
90
        ];
91
    }
92
}
93