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

ConnectionStartFrame   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B create() 0 24 6
1
<?php
2
3
namespace PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Connection;
4
5
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\IncomingFrame;
6
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\MethodFrame;
7
8
/**
9
 * Class ConnectionStartFrame
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Connection
12
 */
13
class ConnectionStartFrame implements MethodFrame, IncomingFrame
14
{
15
    const METHOD_ID = 0x000a000a;
16
17
    public $frameChannelId = 0;
18
    public $versionMajor = 0; // octet
19
    public $versionMinor = 9; // octet
20
    public $serverProperties = []; // table
21
    public $mechanisms = 'PLAIN'; // longstr
22
    public $locales = 'en_US'; // longstr
23
24
    public static function create(
25
        $versionMajor = null, $versionMinor = null, $serverProperties = null, $mechanisms = null, $locales = null
26
    )
27
    {
28
        $frame = new self();
29
30
        if (null !== $versionMajor) {
31
            $frame->versionMajor = $versionMajor;
32
        }
33
        if (null !== $versionMinor) {
34
            $frame->versionMinor = $versionMinor;
35
        }
36
        if (null !== $serverProperties) {
37
            $frame->serverProperties = $serverProperties;
38
        }
39
        if (null !== $mechanisms) {
40
            $frame->mechanisms = $mechanisms;
41
        }
42
        if (null !== $locales) {
43
            $frame->locales = $locales;
44
        }
45
46
        return $frame;
47
    }
48
}
49