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

BasicQosFrame   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 18 4
1
<?php
2
3
namespace PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic;
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 BasicQosFrame
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic
12
 */
13
class BasicQosFrame implements MethodFrame, OutgoingFrame
14
{
15
    const METHOD_ID = 0x003c000a;
16
17
    public $frameChannelId = 0;
18
    public $prefetchSize = 0; // long
19
    public $prefetchCount = 0; // short
20
    public $global = false; // bit
21
22
    public static function create(
23
        $prefetchSize = null, $prefetchCount = null, $global = null
24
    )
25
    {
26
        $frame = new self();
27
28
        if (null !== $prefetchSize) {
29
            $frame->prefetchSize = $prefetchSize;
30
        }
31
        if (null !== $prefetchCount) {
32
            $frame->prefetchCount = $prefetchCount;
33
        }
34
        if (null !== $global) {
35
            $frame->global = $global;
36
        }
37
38
        return $frame;
39
    }
40
}
41