Code Duplication    Length = 89-89 lines in 2 locations

src/jobs/JobBindingCreateToExchange.php 1 location

@@ 11-99 (lines=89) @@
8
use mcorten87\rabbitmq_api\objects\RoutingKey;
9
use mcorten87\rabbitmq_api\objects\VirtualHost;
10
11
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

src/jobs/JobBindingCreateToQueue.php 1 location

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