Completed
Push — master ( 4447aa...e37fbd )
by Vasily
09:14 queued 04:58
created

QueueDeclareFrame   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 45
loc 45
rs 10
c 0
b 0
f 0
wmc 8
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
D create() 30 30 8

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 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 QueueDeclareFrame
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Queue
12
 */
13 View Code Duplication
class QueueDeclareFrame 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 = 0x0032000a;
16
17
    public $frameChannelId = 0;
18
    public $reserved1 = 0; // short
19
    public $queue = ''; // shortstr
20
    public $passive = false; // bit
21
    public $durable = false; // bit
22
    public $exclusive = false; // bit
23
    public $autoDelete = false; // bit
24
    public $nowait = false; // bit
25
    public $arguments = []; // table
26
27
    public static function create(
28
        $queue = null, $passive = null, $durable = null, $exclusive = null, $autoDelete = null, $nowait = null, $arguments = null
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 129 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
29
    )
30
    {
31
        $frame = new self();
32
33
        if (null !== $queue) {
34
            $frame->queue = $queue;
35
        }
36
        if (null !== $passive) {
37
            $frame->passive = $passive;
38
        }
39
        if (null !== $durable) {
40
            $frame->durable = $durable;
41
        }
42
        if (null !== $exclusive) {
43
            $frame->exclusive = $exclusive;
44
        }
45
        if (null !== $autoDelete) {
46
            $frame->autoDelete = $autoDelete;
47
        }
48
        if (null !== $nowait) {
49
            $frame->nowait = $nowait;
50
        }
51
        if (null !== $arguments) {
52
            $frame->arguments = $arguments;
53
        }
54
55
        return $frame;
56
    }
57
}
58