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/Slot.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
/*
4
 * This file is part of the SlotMachine library.
5
 *
6
 * (c) Adam Elsodaney <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SlotMachine;
13
14
/**
15
 * A slot will hold the reel of cards and retrieve a card from it.
16
 *
17
 * @author Adam Elsodaney <[email protected]>
18
 */
19
class Slot implements SlotInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $name;
25
26
    /**
27
     * @var array
28
     */
29
    protected $keys;
30
31
    /**
32
     * @var array
33
     */
34
    protected $reel;
35
36
    /**
37
     * @var array
38
     */
39
    protected $nested = array();
40
41
    /**
42
     * @var array
43
     */
44
    protected $aliases = array();
45
46
    /**
47
     * @var integer
48
     */
49
    protected $undefinedCardResolution = UndefinedCardResolution::NO_CARD_FOUND_EXCEPTION;
50
51
    /**
52
     * @param array
53
     */
54
    public function __construct(array $data)
55
    {
56
        $this->name     = $data['name'];
57
        $this->keys     = $data['keys'];
58
        $this->reel     = $data['reel'];
59
        $this->aliases  = array_replace($this->aliases, isset($data['reel']['aliases']) ? $data['reel']['aliases'] : array());
60
        $this->nested   = array_key_exists('nested', $data) ? $data['nested'] : array();
61
        $this->undefinedCardResolution = array_key_exists('undefined_card', $data)
62
            ? $data['undefined_card']
63
            : UndefinedCardResolution::NO_CARD_FOUND_EXCEPTION;
64
    }
65
66
    public function getUcr()
67
    {
68
        return $this->undefinedCardResolution;
69
    }
70
71
    /**
72
     * Get a value of a card by its index.
73
     * If the card does not exist, resolve based on the slot's resolve_undefined setting.
74
     *
75
     * @param  integer $index
76
     * @return mixed
77
     * @throws SlotMachine\Exception\NoCardFoundException if the key does not exist and
78
     *         the undefinedCardResolution property is set to NO_CARD_FOUND_EXCEPTION.
79
     */
80
    public function getCard($index = 0, $failOnNoCardFound = false)
81
    {
82
        if (!array_key_exists($index, $this->reel['cards'])) {
83
            if ($failOnNoCardFound) {
84
                throw new Exception\NoCardFoundException(sprintf(
85
                    "Cannot resolve a card value for the '%s' slot. (Perhaps you need to set a '_default' alias for the slot or the card of index 0 is missing from the slot's assigned reel?)",
86
		    $this->name
87
                ));
88
            }
89
            switch ($this->undefinedCardResolution) {
90
                case UndefinedCardResolution::NO_CARD_FOUND_EXCEPTION:
91
                default:
92
                    throw new Exception\NoCardFoundException(sprintf(
93
                        "Card of index %d was not found in the slot `%s`.", $index, $this->name
94
                    ));
95
96
                case UndefinedCardResolution::DEFAULT_CARD:
0 ignored issues
show
case \SlotMachine\Undefi...this->getDefaultCard(); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
97
                    return $this->getDefaultCard();
98
99
                case UndefinedCardResolution::FALLBACK_CARD:
100
                    return $this->getFallbackCard();
101
102
                case UndefinedCardResolution::BLANK_CARD:
103
                    return '';
104
105
                // End Switch
106
            }
107
        }
108
        return $this->reel['cards'][$index];
109
    }
110
111
    /**
112
     * Get a card from the reel by an alias.
113
     *
114
     * @param  string $alias
115
     * @return mixed
116
     */
117
    public function getCardByAlias($alias)
118
    {
119
        if (!array_key_exists($alias, $this->aliases)) {
120
            throw new Exception\NoSuchAliasException(sprintf('Alias "%s" has not been assigned to any cards.', $alias));
121
        }
122
123
        return $this->getCard($this->aliases[$alias]);
124
    }
125
126
    /**
127
     * @return string
128
     */
129
    public function getDefaultCard()
130
    {
131
        try {
132
            return $this->getCardByAlias('_default');
133
        } catch (Exception\NoSuchAliasException $e) {
134
            return $this->getCard(0, true);
135
        }
136
    }
137
138
    /**
139
     * @return string
140
     */
141
    public function getFallbackCard()
142
    {
143
        try {
144
            return $this->getCardByAlias('_fallback');
145
        } catch (Exception\NoSuchAliasException $e) {
146
            return $this->getCard();
147
        }
148
    }
149
150
    /**
151
     * @return integer|null
152
     */
153
    public function getDefaultIndex()
154
    {
155
        return array_key_exists('_default', $this->aliases) ? $this->aliases['_default'] : null;
156
    }
157
158
    /**
159
     * @return integer|null
160
     */
161
    public function getFallbackIndex()
162
    {
163
        return array_key_exists('_fallback', $this->aliases) ? $this->aliases['_fallback'] : null;
164
    }
165
166
    /**
167
     * @return integer
168
     */
169
    public function getResolvableIndex()
170
    {
171
        if (array_key_exists('_default', $this->aliases)) {
172
            return $this->aliases['_default'];
173
        } elseif (array_key_exists('_fallback', $this->aliases)) {
174
            return $this->aliases['_fallback'];
175
        }
176
177
        return 0;
178
    }
179
180
    /**
181
     * @return array
182
     */
183
    public function getNested()
184
    {
185
        return $this->nested;
186
    }
187
188
    /**
189
     * @return string
190
     */
191
    public function getKey()
192
    {
193
        return $this->keys[0];
194
    }
195
196
    /**
197
     * @return array
198
     */
199
    public function getKeys()
200
    {
201
        return $this->keys;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function __toString()
208
    {
209
        try {
210
            return $this->getCard();
211
        } catch (Exception\NoCardFoundException $e) {
212
            return "";
213
        }
214
    }
215
}
216