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