1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace mcorten87\rabbitmq_api\jobs; |
4
|
|
|
|
5
|
|
|
use mcorten87\rabbitmq_api\objects\DestinationType; |
6
|
|
|
use mcorten87\rabbitmq_api\objects\Exchange; |
7
|
|
|
use mcorten87\rabbitmq_api\objects\ExchangeName; |
8
|
|
|
use mcorten87\rabbitmq_api\objects\QueueName; |
9
|
|
|
use mcorten87\rabbitmq_api\objects\RoutingKey; |
10
|
|
|
use mcorten87\rabbitmq_api\objects\VirtualHost; |
11
|
|
|
|
12
|
|
View Code Duplication |
class JobBindingToQueueDelete extends JobBase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var VirtualHost |
16
|
|
|
*/ |
17
|
|
|
private $virtualHost; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var QueueName |
21
|
|
|
*/ |
22
|
|
|
private $queueName; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var ExchangeName |
26
|
|
|
*/ |
27
|
|
|
private $exchangeName; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var DestinationType |
31
|
|
|
*/ |
32
|
|
|
private $destinationType; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var RoutingKey |
36
|
|
|
*/ |
37
|
|
|
private $routingKey; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return VirtualHost |
41
|
|
|
*/ |
42
|
|
|
public function getVirtualHost() : VirtualHost |
43
|
|
|
{ |
44
|
|
|
return $this->virtualHost; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return QueueName |
49
|
|
|
*/ |
50
|
|
|
public function getQueueName(): QueueName |
51
|
|
|
{ |
52
|
|
|
return $this->queueName; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return ExchangeName |
57
|
|
|
*/ |
58
|
|
|
public function getExchangeName() |
59
|
|
|
{ |
60
|
|
|
return $this->exchangeName; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return DestinationType |
65
|
|
|
*/ |
66
|
|
|
public function getDestinationType(): string |
67
|
|
|
{ |
68
|
|
|
return $this->destinationType; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return RoutingKey |
73
|
|
|
*/ |
74
|
|
|
public function getRoutingKey() |
75
|
|
|
{ |
76
|
|
|
return $this->routingKey; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* JobExchangeCreate constructor. |
81
|
|
|
* @param VirtualHost $virtualHost |
82
|
|
|
* @param ExchangeName $exchangeName |
83
|
|
|
*/ |
84
|
|
|
public function __construct(VirtualHost $virtualHost, QueueName $queueName, ExchangeName $exchangeName, RoutingKey $routingKey = null) |
85
|
|
|
{ |
86
|
|
|
$this->virtualHost = $virtualHost; |
87
|
|
|
$this->queueName = $queueName; |
88
|
|
|
$this->exchangeName = $exchangeName; |
89
|
|
|
|
90
|
|
|
$this->destinationType = new DestinationType(DestinationType::QUEUE); |
91
|
|
|
$this->routingKey = $routingKey !== null ? $routingKey : new RoutingKey(''); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
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.