This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 Mouf\AmqpClient\Objects; |
||
4 | |||
5 | use Mouf\AmqpClient\Client; |
||
6 | use Mouf\AmqpClient\RabbitMqObjectInterface; |
||
7 | use PhpAmqpLib\Channel\AMQPChannel; |
||
8 | |||
9 | /** |
||
10 | * Represents an "exchange" object in AMQP protocol. |
||
11 | * In AMQP, "messages" are sent to exchanges. Exchanges are meant to dispatch messages to "queues". |
||
12 | */ |
||
13 | class Exchange implements RabbitMqObjectInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var Client |
||
17 | */ |
||
18 | private $client; |
||
19 | |||
20 | /** |
||
21 | * Name. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | private $name; |
||
26 | |||
27 | /** |
||
28 | * Type direct, topic, headers or fanout. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $type; |
||
33 | |||
34 | /** |
||
35 | * Passive. |
||
36 | * |
||
37 | * @var bool |
||
38 | */ |
||
39 | private $passive = false; |
||
40 | |||
41 | /** |
||
42 | * Durable. |
||
43 | * |
||
44 | * @var bool |
||
45 | */ |
||
46 | private $durable = false; |
||
47 | |||
48 | /** |
||
49 | * Auto delete. |
||
50 | * |
||
51 | * @var bool |
||
52 | */ |
||
53 | private $autoDelete = false; |
||
54 | |||
55 | /** |
||
56 | * Internal. |
||
57 | * |
||
58 | * @var bool |
||
59 | */ |
||
60 | private $internal = false; |
||
61 | |||
62 | /** |
||
63 | * No wait. |
||
64 | * |
||
65 | * @var bool |
||
66 | */ |
||
67 | private $nowait = false; |
||
68 | |||
69 | /** |
||
70 | * Arguments. |
||
71 | * |
||
72 | * @var array |
||
73 | */ |
||
74 | private $arguments = null; |
||
75 | |||
76 | /** |
||
77 | * Ticket. |
||
78 | * |
||
79 | * @var int |
||
80 | */ |
||
81 | private $ticket = null; |
||
82 | |||
83 | /** |
||
84 | * Parameter to initialize object only one time. |
||
85 | * |
||
86 | * @var bool |
||
87 | */ |
||
88 | private $init = false; |
||
89 | |||
90 | /** |
||
91 | * Set the to (Binding). |
||
92 | * |
||
93 | * @param Client $to |
||
0 ignored issues
–
show
|
|||
94 | * @param string $name |
||
95 | * @param string $type direct, topic, headers or fanout |
||
96 | */ |
||
97 | public function __construct(Client $client, $name, $type) |
||
98 | { |
||
99 | $this->client = $client; |
||
100 | $this->client->register($this); |
||
101 | if ($name === '' && !$this instanceof DefaultExchange) { |
||
102 | throw new \InvalidArgumentException('An exchange cannot have an empty name. If you want to target the RabbitMQ default exchange, please use the DefaultExchange class instead.'); |
||
103 | } |
||
104 | $this->name = $name; |
||
105 | $this->type = $type; |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * Get the exchange name. |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | public function getName() |
||
114 | { |
||
115 | return $this->name; |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * Get passive. |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function getPassive() |
||
124 | { |
||
125 | return $this->passive; |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * Set passive. |
||
130 | * |
||
131 | * @param bool $passive |
||
132 | * |
||
133 | * @return Exchange |
||
134 | */ |
||
135 | public function setPassive($passive) |
||
136 | { |
||
137 | $this->passive = $passive; |
||
138 | |||
139 | return $this; |
||
140 | } |
||
141 | |||
142 | /** |
||
143 | * Get durable. |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | public function getDurable() |
||
148 | { |
||
149 | return $this->durable; |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Set durable. |
||
154 | * |
||
155 | * @param bool $durable |
||
156 | * |
||
157 | * @return Exchange |
||
158 | */ |
||
159 | public function setDurable($durable) |
||
160 | { |
||
161 | $this->durable = $durable; |
||
162 | |||
163 | return $this; |
||
164 | } |
||
165 | |||
166 | /** |
||
167 | * Get autoDelete. |
||
168 | * |
||
169 | * @return bool |
||
170 | */ |
||
171 | public function getAutoDelete() |
||
172 | { |
||
173 | return $this->autoDelete; |
||
174 | } |
||
175 | |||
176 | /** |
||
177 | * Set autoDelete. |
||
178 | * |
||
179 | * @param bool $autoDelete |
||
180 | * |
||
181 | * @return Exchange |
||
182 | */ |
||
183 | public function setAutoDelete($autoDelete) |
||
184 | { |
||
185 | $this->autoDelete = $autoDelete; |
||
186 | |||
187 | return $this; |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * Get internal. |
||
192 | * |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function getInternal() |
||
196 | { |
||
197 | return $this->internal; |
||
198 | } |
||
199 | |||
200 | /** |
||
201 | * Set internal. |
||
202 | * |
||
203 | * @param bool $internal |
||
204 | * |
||
205 | * @return Exchange |
||
206 | */ |
||
207 | public function setInternal($internal) |
||
208 | { |
||
209 | $this->internal = $internal; |
||
210 | |||
211 | return $this; |
||
212 | } |
||
213 | |||
214 | /** |
||
215 | * Get nowait. |
||
216 | * |
||
217 | * @return bool |
||
218 | */ |
||
219 | public function getNowait() |
||
220 | { |
||
221 | return $this->nowait; |
||
222 | } |
||
223 | |||
224 | /** |
||
225 | * Set nowait. |
||
226 | * |
||
227 | * @param bool $nowait |
||
228 | * |
||
229 | * @return Exchange |
||
230 | */ |
||
231 | public function setNowait($nowait) |
||
232 | { |
||
233 | $this->nowait = $nowait; |
||
234 | |||
235 | return $this; |
||
236 | } |
||
237 | |||
238 | /** |
||
239 | * Get arguments. |
||
240 | * |
||
241 | * @return array |
||
242 | */ |
||
243 | public function getArguments() |
||
244 | { |
||
245 | return $this->arguments; |
||
246 | } |
||
247 | |||
248 | /** |
||
249 | * Set arguments. |
||
250 | * |
||
251 | * @param array $arguments |
||
252 | * |
||
253 | * @return Exchange |
||
254 | */ |
||
255 | public function setArguments($arguments) |
||
256 | { |
||
257 | $this->arguments = $arguments; |
||
258 | |||
259 | return $this; |
||
260 | } |
||
261 | |||
262 | /** |
||
263 | * Get ticket. |
||
264 | * |
||
265 | * @return int |
||
266 | */ |
||
267 | public function getTicket() |
||
268 | { |
||
269 | return $this->ticket; |
||
270 | } |
||
271 | |||
272 | /** |
||
273 | * Set ticket. |
||
274 | * |
||
275 | * @param int $ticket |
||
276 | * |
||
277 | * @return Exchange |
||
278 | */ |
||
279 | public function setTicket($ticket) |
||
280 | { |
||
281 | $this->ticket = $ticket; |
||
282 | |||
283 | return $this; |
||
284 | } |
||
285 | |||
286 | public function init(AMQPChannel $amqpChannel) |
||
287 | { |
||
288 | if (!$this->init) { |
||
289 | $amqpChannel->exchange_declare($this->name, |
||
290 | $this->type, |
||
291 | $this->passive, |
||
292 | $this->durable, |
||
293 | $this->autoDelete, |
||
294 | $this->internal, |
||
295 | $this->nowait, |
||
296 | $this->arguments, |
||
297 | $this->ticket); |
||
298 | $this->init = true; |
||
299 | } |
||
300 | } |
||
301 | |||
302 | View Code Duplication | public function publish(Message $message, $routingKey, $mandatory = false, |
|
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. ![]() |
|||
303 | $immediate = false, |
||
304 | $ticket = null) |
||
305 | { |
||
306 | $channel = $this->client->getChannel(); |
||
307 | |||
308 | $channel->basic_publish($message->toAMQPMessage(), $this->name, $routingKey, $mandatory, $immediate, $ticket); |
||
309 | } |
||
310 | } |
||
311 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.