Completed
Pull Request — master (#286)
by
unknown
03:20
created

QueueUnbindFrame::create()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 21
Code Lines 12

Duplication

Lines 21
Ratio 100 %

Importance

Changes 0
Metric Value
cc 5
eloc 12
nc 16
nop 4
dl 21
loc 21
rs 8.7624
c 0
b 0
f 0
1
<?php
2
3
namespace PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Queue;
4
5
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\MethodFrame;
6
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\OutgoingFrame;
7
8
/**
9
 * Class QueueUnbindFrame
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Queue
12
 */
13 View Code Duplication
class QueueUnbindFrame implements MethodFrame, OutgoingFrame
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...
14
{
15
    const METHOD_ID = 0x00320032;
16
17
    public $frameChannelId = 0;
18
    public $reserved1 = 0; // short
19
    public $queue = ''; // shortstr
20
    public $exchange; // shortstr
21
    public $routingKey = ''; // shortstr
22
    public $arguments = []; // table
23
24
    public static function create(
25
        $queue = null, $exchange = null, $routingKey = null, $arguments = null
26
    )
27
    {
28
        $frame = new self();
29
30
        if (null !== $queue) {
31
            $frame->queue = $queue;
32
        }
33
        if (null !== $exchange) {
34
            $frame->exchange = $exchange;
35
        }
36
        if (null !== $routingKey) {
37
            $frame->routingKey = $routingKey;
38
        }
39
        if (null !== $arguments) {
40
            $frame->arguments = $arguments;
41
        }
42
43
        return $frame;
44
    }
45
}
46