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

BasicQosFrame::create()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 10
nc 8
nop 3
dl 0
loc 18
rs 9.2
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\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