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

BasicPublishFrame   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B create() 0 21 5
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\MethodFrame;
7
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\OutgoingFrame;
8
9
/**
10
 * Class BasicPublishFrame
11
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
12
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic
13
 */
14
class BasicPublishFrame implements MethodFrame, ContentPrecursorFrame, OutgoingFrame
15
{
16
    const METHOD_ID = 0x003c0028;
17
18
    public $frameChannelId = 0;
19
    public $reserved1 = 0; // short
20
    public $exchange = ''; // shortstr
21
    public $routingKey = ''; // shortstr
22
    public $mandatory = false; // bit
23
    public $immediate = false; // bit
24
25
    public static function create(
26
        $exchange = null, $routingKey = null, $mandatory = null, $immediate = null
27
    )
28
    {
29
        $frame = new self();
30
31
        if (null !== $exchange) {
32
            $frame->exchange = $exchange;
33
        }
34
        if (null !== $routingKey) {
35
            $frame->routingKey = $routingKey;
36
        }
37
        if (null !== $mandatory) {
38
            $frame->mandatory = $mandatory;
39
        }
40
        if (null !== $immediate) {
41
            $frame->immediate = $immediate;
42
        }
43
44
        return $frame;
45
    }
46
}
47