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

BasicDeliverFrame::create()   B

Complexity

Conditions 6
Paths 32

Size

Total Lines 24
Code Lines 14

Duplication

Lines 24
Ratio 100 %

Importance

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