Completed
Pull Request — master (#286)
by
unknown
06:13
created

QueuePurgeFrame   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 25
loc 25
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 15 15 3

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 QueuePurgeFrame
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Queue
12
 */
13 View Code Duplication
class QueuePurgeFrame 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 = 0x0032001e;
16
17
    public $frameChannelId = 0;
18
    public $reserved1 = 0; // short
19
    public $queue = ''; // shortstr
20
    public $nowait = false; // bit
21
22
    public static function create(
23
        $queue = null, $nowait = null
24
    )
25
    {
26
        $frame = new self();
27
28
        if (null !== $queue) {
29
            $frame->queue = $queue;
30
        }
31
        if (null !== $nowait) {
32
            $frame->nowait = $nowait;
33
        }
34
35
        return $frame;
36
    }
37
}
38