Issues (308)

Security Analysis    not enabled

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/events/interfaces/Emitter.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 namespace nyx\events\interfaces;
2
3
/**
4
 * Event Emitter Interface
5
 *
6
 * Event synchronization point. Registers/removes listeners for events and emits events. Supports registering
7
 * listeners by priority and subscribers.
8
 *
9
 * @version     0.1.0
10
 * @author      Michal Chojnacki <[email protected]>
11
 * @copyright   2012-2017 Nyx Dev Team
12
 * @link        https://github.com/unyx/nyx
13
 * @todo        Decide: Optionally append the Emitter instance and event type to the payload when emitting?
14
 * @todo        Decide: Event propagation stopping?
15
 * @todo        Decide: Wildcard events / channel support?
16
 */
17
interface Emitter
18
{
19
    /**
20
     * Triggers the listeners of a given event.
21
     *
22
     * @param   string|Event    $event          The name of the event to emit or an object implementing the Event
23
     *                                          interface, whose name will be used.
24
     * @param   mixed           ...$payload     The data to pass to listeners, in the order given. If $event is an
25
     *                                          instance of the Event interface, it will be prepended to the $payload.
26
     */
27
    public function emit($event, ...$payload);
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
28
29
    /**
30
     * Adds an event listener that listens to the specified event.
31
     *
32
     * @param   string   $event             The event to listen for.
33
     * @param   callable $listener          The listener to add.
34
     * @param   integer  $priority          The higher this value, the earlier an event listener will be triggered.
35
     * @return  $this
36
     */
37
    public function on(string $event, callable $listener, int $priority = 0) : Emitter;
38
39
    /**
40
     * Adds an event listener that listens to the specified event but only gets fired once and then removed from
41
     * the stack.
42
     *
43
     * @param   string      $event          The event to listen for.
44
     * @param   callable    $listener       The listener to add.
45
     * @param   integer     $priority       The higher this value, the earlier an event listener will be triggered
46
     *                                      in the chain.
47
     * @return  $this
48
     */
49
    public function once(string $event, callable $listener, int $priority = 0) : Emitter;
50
51
    /**
52
     * Removes the specified listener from the stack of a given event, OR
53
     * removes all listeners for a given event name when only $listener is null, OR
54
     * removes the given listener from all events it's listening to when only $name is null, OR
55
     * removes all listeners registered in this Emitter if both $name and $listener are null,
56
     *
57
     * @param   string      $event      The event to remove the listener from.
58
     * @param   callable    $listener   The listener to remove.
59
     * @return  $this
60
     */
61
    public function off(string $event = null, callable $listener = null) : Emitter;
62
63
    /**
64
     * Registers an Event Subscriber with this Emitter. The Subscriber is queried for a list of events
65
     * he is interested in and afterwards registered as a listener for them.
66
     *
67
     * @param   Subscriber  $subscriber
68
     * @return  $this
69
     */
70
    public function register(Subscriber $subscriber) : Emitter;
71
72
    /**
73
     * Deregisters an Event Subscriber from this Emitter, removing all listeners it has registered
74
     * with.
75
     *
76
     * @param   Subscriber  $subscriber
77
     * @return  $this
78
     */
79
    public function deregister(Subscriber $subscriber) : Emitter;
80
81
    /**
82
     * Returns an array containing the priority-sorted listeners for the given event or for all events
83
     * if no event name is given.
84
     *
85
     * @param   string  $event  The name of the event.
86
     * @return  array           The event listeners for the specified event.
87
     */
88
    public function getListeners(string $event = null) : array;
89
90
    /**
91
     * Checks whether the given event has any listeners or when no event name is given whether any listeners
92
     * at all are registered.
93
     *
94
     * @param   string  $event  The name of the event.
95
     * @return  bool
96
     */
97
    public function hasListeners(string $event = null) : bool;
98
99
    /**
100
     * Returns the count of the listeners for the given event or the count of all registered listeners if
101
     * no event name is given.
102
     *
103
     * @param   string  $event  The name of the event.
104
     * @return  int
105
     */
106
    public function countListeners(string $event = null) : int;
107
}
108