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