Passed
Branch master (028697)
by Mathijs
08:46
created

JobExchangeCreate::addArgument()   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\Exchange;
6
use mcorten87\rabbitmq_api\objects\ExchangeArgument;
7
use mcorten87\rabbitmq_api\objects\ExchangeName;
8
use mcorten87\rabbitmq_api\objects\QueueArgument;
9
use mcorten87\rabbitmq_api\objects\QueueName;
10
use mcorten87\rabbitmq_api\objects\VirtualHost;
11
12 View Code Duplication
class JobExchangeCreate 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
     * @var ExchangeName
21
     */
22
    private $exchangeName;
23
24
    /**
25
     * @var bool
26
     */
27
    private $autoDelete = false;
28
29
    /**
30
     * @var bool
31
     */
32
    private $durable = true;
33
34
    /**
35
     * @var QueueArgument[]
36
     */
37
    private $arguments = [];
38
39
40
    /**
41
     * @param boolean $autoDelete
42
     */
43
    public function setAutoDelete($autoDelete)
44
    {
45
        $this->autoDelete = $autoDelete;
46
    }
47
48
    /**
49
     * @param boolean $durable
50
     */
51
    public function setDurable($durable)
52
    {
53
        $this->durable = $durable;
54
    }
55
56
    /**
57
     * @return \mcorten87\rabbitmq_api\objects\ExchangeArgument[]
58
     */
59
    public function getArguments()
60
    {
61
        return $this->arguments;
62
    }
63
64
    /**
65
     * @param ExchangeArgument $newArgument
0 ignored issues
show
Documentation introduced by
There is no parameter named $newArgument. Did you maybe mean $argument?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
66
     */
67
    public function addArgument(ExchangeArgument $argument)
68
    {
69
        $this->arguments[] = $argument;
70
    }
71
72
    /** @return VirtualHost */
73
    public function getVirtualHost() : VirtualHost
74
    {
75
        return $this->virtualHost;
76
    }
77
78
    /**
79
     * @return ExchangeName
80
     */
81
    public function getExchangeName()
82
    {
83
        return $this->exchangeName;
84
    }
85
86
    /**
87
     * @return boolean
88
     */
89
    public function isAutoDelete()
90
    {
91
        return $this->autoDelete;
92
    }
93
94
    /**
95
     * @return boolean
96
     */
97
    public function isDurable()
98
    {
99
        return $this->durable;
100
    }
101
102
    /**
103
     * JobExchangeCreate constructor.
104
     * @param VirtualHost $virtualHost
105
     * @param ExchangeName $exchangeName
106
     */
107
    public function __construct(VirtualHost $virtualHost, ExchangeName $exchangeName)
108
    {
109
        $this->virtualHost = $virtualHost;
110
        $this->exchangeName = $exchangeName;
111
    }
112
}
113