Completed
Push — master ( 35955d...721d5f )
by Mathijs
02:31
created

JobBindingCreateToExchange::setRoutingKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
0 ignored issues
show
Duplication introduced by
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...
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;
0 ignored issues
show
Bug introduced by
The property exchangeName does not seem to exist. Did you mean exchange?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
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;
0 ignored issues
show
Bug introduced by
The property exchangeName does not seem to exist. Did you mean exchange?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
94
        $this->toExchange = $to;
95
96
        $this->destinationType = new DestinationType(DestinationType::EXCHANGE);
97
        $this->routingKey = new RoutingKey('');
98
    }
99
}
100