Completed
Push — master ( 626bcc...764be1 )
by Mathijs
04:43 queued 04:43
created

JobBindingToQueueCreate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 83
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 3
dl 83
loc 83
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getVirtualHost() 4 4 1
A getQueueName() 4 4 1
A getExchangeName() 4 4 1
A getDestinationType() 4 4 1
A getRoutingKey() 4 4 1
A __construct() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 JobBindingToQueueCreate 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...
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
     * @return VirtualHost
42
     */
43
    public function getVirtualHost() : VirtualHost
44
    {
45
        return $this->virtualHost;
46
    }
47
48
    /**
49
     * @return QueueName
50
     */
51
    public function getQueueName(): QueueName
52
    {
53
        return $this->queueName;
54
    }
55
56
    /**
57
     * @return ExchangeName
58
     */
59
    public function getExchangeName()
60
    {
61
        return $this->exchangeName;
62
    }
63
64
    /**
65
     * @return DestinationType
66
     */
67
    public function getDestinationType(): string
68
    {
69
        return $this->destinationType;
70
    }
71
72
    /**
73
     * @return RoutingKey
74
     */
75
    public function getRoutingKey()
76
    {
77
        return $this->routingKey;
78
    }
79
80
    /**
81
     * JobExchangeCreate constructor.
82
     * @param VirtualHost $virtualHost
83
     * @param ExchangeName $exchangeName
84
     */
85
    public function __construct(VirtualHost $virtualHost, QueueName $queueName, ExchangeName $exchangeName, RoutingKey $routingKey = null)
0 ignored issues
show
Unused Code introduced by
The parameter $routingKey is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
86
    {
87
        $this->virtualHost = $virtualHost;
88
        $this->queueName = $queueName;
89
        $this->exchangeName = $exchangeName;
90
91
        $this->destinationType = new DestinationType(DestinationType::QUEUE);
92
        $this->routingKey = new RoutingKey('');
93
    }
94
}
95