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

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/Statemachine/Statemachine.php (3 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 Noodle\Statemachine;
4
5
use ArrayObject as Context;
6
use Generator;
7
use League\Event\Emitter;
8
use League\Event\Event;
9
use League\Event\ListenerInterface as Listener;
10
use Noodle\Listener\ChangesState;
11
use Noodle\Listener\ReportsTransitionFailures;
12
use Noodle\State\FlyweightState;
13
use Noodle\State\State;
14
use Noodle\Stateful\Stateful;
15
use Noodle\Statemachine\Exception as NoodleException;
16
use Noodle\Statemachine\Exception\StateTransitionFailed;
17
use Noodle\Transition\Input\FlyweightInput;
18
use Noodle\Transition\Input\Input;
19
use Noodle\Transition\Table\TransitionTable;
20
21
final class Statemachine implements EventfulStatemachine
22
{
23
    /**
24
     * The emitter used to emit events
25
     *
26
     * @var Emitter
27
     */
28
    private $emitter;
29
30
    /**
31
     * Transition table used to determine which states support which actions
32
     *
33
     * @var TransitionTable
34
     */
35
    private $stateTransitionTable;
36
37
    /**
38
     * Constructor
39
     *
40
     * @param TransitionTable $stateTransitionTable
41
     * @param Listener $failureHandler (Optional) Listener that handles transition failures
42
     * @param Listener $stateChanger (Optional) Listener that updates the object's state
43
     */
44 8
    public function __construct(
45
        TransitionTable $stateTransitionTable,
46
        Listener $failureHandler = null,
47
        Listener $stateChanger = null
48
    ) {
49 8
        $this->stateTransitionTable = $stateTransitionTable;
50 8
        $this->emitter = new Emitter();
51
52 8
        if (!$stateChanger) {
53 7
            $stateChanger = new ChangesState();
54
        }
55
56 8
        $this->emitter->addListener(
57 8
            $this->getEventName('on', FlyweightInput::any(), FlyweightState::any()),
58
            $stateChanger
59
        );
60
61 8
        if (!$failureHandler) {
62 8
            $failureHandler = new ReportsTransitionFailures();
63
        }
64
65 8
        $this->emitter->addListener('failed', $failureHandler);
66 8
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71 8
    public function trigger(Input $input, Stateful $object)
72
    {
73 8
        $context = new Context();
74 8
        $nextState = $this->stateTransitionTable->resolve($object->getCurrentState(), $input);
75
76 7
        $this->emitEvents($input, $object, $context, $nextState);
77 5
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82 1
    public function after(Input $input, State $currentState, Listener $listener, int $priority = Emitter::P_NORMAL)
83
    {
84 1
        $this->emitter->addListener(
85 1
            $this->getEventName('after', $input, $currentState),
86
            $listener,
0 ignored issues
show
$listener is of type object<League\Event\ListenerInterface>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
87
            $priority
88
        );
89 1
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94 3
    public function before(Input $input, State $currentState, Listener $listener, int $priority = Emitter::P_NORMAL)
95
    {
96 3
        $this->emitter->addListener(
97 3
            $this->getEventName('before', $input, $currentState),
98
            $listener,
0 ignored issues
show
$listener is of type object<League\Event\ListenerInterface>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
99
            $priority
100
        );
101 3
    }
102
103
    /**
104
     * {@inheritdoc}
105
     */
106 1
    public function on(Input $input, State $currentState, Listener $listener, int $priority = Emitter::P_NORMAL)
107
    {
108 1
        $this->emitter->addListener(
109 1
            $this->getEventName('on', $input, $currentState),
110
            $listener,
0 ignored issues
show
$listener is of type object<League\Event\ListenerInterface>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
111
            $priority
112
        );
113 1
    }
114
115
    /**
116
     * Creates an event name based on an input, current state, and when that event should be emitted
117
     *
118
     * @param string $executedWhen
119
     * @param Input $input
120
     * @param State $currentState
121
     *
122
     * @return string
123
     */
124 8
    private function getEventName(string $executedWhen, Input $input, State $currentState) : string
125
    {
126 8
        return sprintf('%s %s %s', $executedWhen, $input->getName(), $currentState->getName());
127
    }
128
129
    /**
130
     * Emits the events corresponding to applying the provided input on the provided object.
131
     *
132
     * @param Input $input
133
     * @param Stateful $object
134
     * @param Context $context
135
     * @param State $nextState
136
     *
137
     * @return void
138
     *
139
     * @throws StateTransitionFailed
140
     */
141 7
    private function emitEvents(Input $input, Stateful $object, Context $context, State $nextState)
142
    {
143
        /** @var Event $event */
144 7
        foreach ($this->eventProvider($input, $object->getCurrentState()) as $event) {
145 7
            if (!$this->emitter->hasListeners($event->getName())) {
146 5
                continue;
147
            }
148
149 7
            if ($this->emitter->emit($event, $object, $context, $input, $nextState)->isPropagationStopped()) {
150 1
                $this->emitter->emit(Event::named('failed'), $object, $context, $input, $nextState);
151
152 5
                throw new StateTransitionFailed($input, $object, $context, $nextState);
153
            }
154
        }
155 5
    }
156
157
    /**
158
     * Returns events to be emitted whenever a state transition is attempted
159
     *
160
     * @param Input $input
161
     * @param State $currentState
162
     *
163
     * @return Generator
164
     */
165 7
    private function eventProvider(Input $input, State $currentState) : Generator
166
    {
167 7
        $anyInput = FlyweightInput::any();
168 7
        $anyState = FlyweightState::any();
169
170 7
        yield Event::named($this->getEventName('before', $input, $currentState));
171 5
        yield Event::named($this->getEventName('before', $anyInput, $currentState));
172 5
        yield Event::named($this->getEventName('before', $input, $anyState));
173 5
        yield Event::named($this->getEventName('before', $anyInput, $anyState));
174
175 5
        yield Event::named($this->getEventName('on', $anyInput, $anyState));
176
177 5
        yield Event::named($this->getEventName('after', $input, $currentState));
178 5
        yield Event::named($this->getEventName('after', $anyInput, $currentState));
179 5
        yield Event::named($this->getEventName('after', $input, $anyState));
180 5
        yield Event::named($this->getEventName('after', $anyInput, $anyState));
181 5
    }
182
}
183