Issues (150)

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/ABS/Dispatcher/MapDispatcher.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 PEIP\ABS\Dispatcher;
4
5
namespace PEIP\ABS\Dispatcher;
6
7
/*
8
 * This file is part of the PEIP package.
9
 * (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
/*
16
 * PEIP\ABS\Dispatcher\MapDispatcher
17
 * Abstract base class for namespaced dispatcher.
18
 * Derived concrete classes can be used (for example) as event dispatchers.
19
 *
20
 * @author Timo Michna <timomichna/yahoo.de>
21
 * @package PEIP
22
 * @subpackage dispatcher
23
 * @extends \PEIP\ABS\Dispatcher\Dispatcher
24
 * @implements \PEIP\INF\Event\Connectable
25
 */
26
27
use PEIP\Util\Test;
28
29
abstract class MapDispatcher extends \PEIP\ABS\Dispatcher\Dispatcher implements //PEIP\INF\Dispatcher\MapDispatcher,
30
        \PEIP\INF\Event\Connectable
31
{
32
    protected $listeners = [];
33
34
    /**
35
     * Connects a listener to a given event-name.
36
     *
37
     * @param string                            $name     name of the event
38
     * @param callable|PEIP\INF\Handler\Handler $listener listener to connect
39
     *
40
     * @return
41
     */
42
    public function connect($name, $listener)
43
    {
44
        Test::ensureHandler($listener);
45
        if (!$this->hasListeners($name)) {
46
            $this->listeners[$name] = [];
47
        }
48
        $this->listeners[$name][] = $listener;
49
50
        return true;
51
    }
52
53
    /**
54
     * Disconnects a listener from a given event-name.
55
     *
56
     * @param string                            $name     name of the event
57
     * @param callable|PEIP\INF\Handler\Handler $listener listener to connect
58
     *
59
     * @return
60
     */
61
    public function disconnect($name, $listener)
62
    {
63
        if (!$this->hasListeners($name)) {
64
            return false;
65
        }
66
        $res = false;
67
        foreach ($this->listeners[$name] as $i => $callable) {
68
            if ($listener === $callable) {
69
                unset($this->listeners[$name][$i]);
70
                $res = true;
71
            }
72
        }
73
74
        return $res;
75
    }
76
77
    /**
78
     * Disconnects a listener from a given event-name.
79
     *
80
     * @param string $name name of the event
81
     *
82
     * @return
83
     */
84 View Code Duplication
    public function disconnectAll($name)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
    {
86
        if (!isset($this->listeners[$name])) {
87
            return false;
88
        }
89
        $this->listeners[$name] = [];
90
91
        return true;
92
    }
93
94
    /**
95
     * Checks wether any listener is registered for a given event-name.
96
     *
97
     * @param string $name name of the event
98
     *
99
     * @return bool wether any listener is registered for event-name
100
     */
101 View Code Duplication
    public function hasListeners($name)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
102
    {
103
        if (!isset($this->listeners[$name])) {
104
            return false;
105
        }
106
107
        return (bool) count($this->listeners[$name]);
108
    }
109
110
    /**
111
     * notifies all listeners on a event on a subject.
112
     *
113
     * @param string $name    name of the event
114
     * @param mixed  $subject the subject
115
     *
116
     * @return bool success
117
     */
118 View Code Duplication
    public function notify($name, $subject)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
119
    {
120
        if ($this->hasListeners($name)) {
121
            self::doNotify($this->getListeners($name), $subject);
122
123
            return true;
124
        }
125
126
        return false;
127
    }
128
129
    /**
130
     * notifies all listeners on a event on a subject until one returns a boolean true value.
131
     *
132
     * @param string $name    name of the event
133
     * @param mixed  $subject the subject
134
     *
135
     * @return \PEIP\INF\Handler\Handler listener which returned a boolean true value
136
     */
137
    public function notifyUntil($name, $subject)
138
    {
139
        if ($this->hasListeners($name)) {
140
            return self::doNotifyUntil($this->getListeners($name), $subject);
141
        }
142
    }
143
144
    /**
145
     * Returns all listeners registered for a given event-name.
146
     *
147
     * @param $name
148
     *
149
     * @return array array of \PEIP\INF\Handler\Handler instances
150
     */
151
    public function getListeners($name)
152
    {
153
        if (!isset($this->listeners[$name])) {
154
            return [];
155
        }
156
157
        return $this->listeners[$name];
158
    }
159
}
160