Issues (89)

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/Event/MultiRequestSentEvent.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
/*
4
 * This file is part of the Ivory Http Adapter package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\HttpAdapter\Event;
13
14
use Ivory\HttpAdapter\HttpAdapterException;
15
use Ivory\HttpAdapter\HttpAdapterInterface;
16
use Ivory\HttpAdapter\Message\ResponseInterface;
17
18
/**
19
 * @author GeLo <[email protected]>
20
 */
21 View Code Duplication
class MultiRequestSentEvent extends AbstractEvent
0 ignored issues
show
This class 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...
22
{
23
    /**
24
     * @var ResponseInterface[]
25
     */
26
    private $responses;
27
28
    /**
29
     * @var HttpAdapterException[]
30
     */
31
    private $exceptions = [];
32
33
    /**
34
     * @param HttpAdapterInterface $httpAdapter
35
     * @param ResponseInterface[]  $responses
36
     */
37 243
    public function __construct(HttpAdapterInterface $httpAdapter, array $responses)
38
    {
39 243
        parent::__construct($httpAdapter);
40
41 243
        $this->setResponses($responses);
42 243
    }
43
44 243
    public function clearResponses()
45
    {
46 243
        $this->responses = [];
47 243
    }
48
49
    /**
50
     * @return bool
51
     */
52 90
    public function hasResponses()
53
    {
54 90
        return !empty($this->responses);
55
    }
56
57
    /**
58
     * @return ResponseInterface[]
59
     */
60 171
    public function getResponses()
61
    {
62 171
        return $this->responses;
63
    }
64
65
    /**
66
     * @param ResponseInterface[] $responses
67
     */
68 243
    public function setResponses(array $responses)
69
    {
70 243
        $this->clearResponses();
71 243
        $this->addResponses($responses);
72 243
    }
73
74
    /**
75
     * @param ResponseInterface[] $responses
76
     */
77 243
    public function addResponses(array $responses)
78
    {
79 243
        foreach ($responses as $response) {
80 243
            $this->addResponse($response);
81 189
        }
82 243
    }
83
84
    /**
85
     * @param ResponseInterface[] $responses
86
     */
87 9
    public function removeResponses(array $responses)
88
    {
89 9
        foreach ($responses as $response) {
90 9
            $this->removeResponse($response);
91 7
        }
92 9
    }
93
94
    /**
95
     * @param ResponseInterface $response
96
     *
97
     * @return bool
98
     */
99 45
    public function hasResponse(ResponseInterface $response)
100
    {
101 45
        return array_search($response, $this->responses, true) !== false;
102
    }
103
104
    /**
105
     * @param ResponseInterface $response
106
     */
107 243
    public function addResponse(ResponseInterface $response)
108
    {
109 243
        $this->responses[] = $response;
110 243
    }
111
112
    /**
113
     * @param ResponseInterface $response
114
     */
115 81
    public function removeResponse(ResponseInterface $response)
116
    {
117 81
        unset($this->responses[array_search($response, $this->responses, true)]);
118 81
        $this->responses = array_values($this->responses);
119 81
    }
120
121 45
    public function clearExceptions()
122
    {
123 45
        $this->exceptions = [];
124 45
    }
125
126
    /**
127
     * @return bool
128
     */
129 99
    public function hasExceptions()
130
    {
131 99
        return !empty($this->exceptions);
132
    }
133
134
    /**
135
     * @return HttpAdapterException[]
136
     */
137 99
    public function getExceptions()
138
    {
139 99
        return $this->exceptions;
140
    }
141
142
    /**
143
     * @param HttpAdapterException[] $exceptions
144
     */
145 45
    public function setExceptions(array $exceptions)
146
    {
147 45
        $this->clearExceptions();
148 45
        $this->addExceptions($exceptions);
149 45
    }
150
151
    /**
152
     * @param HttpAdapterException[] $exceptions
153
     */
154 54
    public function addExceptions(array $exceptions)
155
    {
156 54
        foreach ($exceptions as $exception) {
157 54
            $this->addException($exception);
158 42
        }
159 54
    }
160
161
    /**
162
     * @param HttpAdapterException[] $exceptions
163
     */
164 9
    public function removeExceptions(array $exceptions)
165
    {
166 9
        foreach ($exceptions as $exception) {
167 9
            $this->removeException($exception);
168 7
        }
169 9
    }
170
171
    /**
172
     * @param HttpAdapterException $exception
173
     *
174
     * @return bool
175
     */
176 36
    public function hasException(HttpAdapterException $exception)
177
    {
178 36
        return array_search($exception, $this->exceptions, true) !== false;
179
    }
180
181
    /**
182
     * @param HttpAdapterException $exception
183
     */
184 90
    public function addException(HttpAdapterException $exception)
185
    {
186 90
        $this->exceptions[] = $exception;
187 90
    }
188
189
    /**
190
     * @param HttpAdapterException $exception
191
     */
192 18
    public function removeException(HttpAdapterException $exception)
193
    {
194 18
        unset($this->exceptions[array_search($exception, $this->exceptions, true)]);
195 18
        $this->exceptions = array_values($this->exceptions);
196 18
    }
197
}
198