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

ConnectionTuneOkFrame::create()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 18
Code Lines 10

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
eloc 10
nc 8
nop 3
dl 18
loc 18
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Connection;
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 ConnectionTuneOkFrame
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Connection
12
 */
13 View Code Duplication
class ConnectionTuneOkFrame implements MethodFrame, OutgoingFrame
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...
14
{
15
    const METHOD_ID = 0x000a001f;
16
17
    public $frameChannelId = 0;
18
    public $channelMax = 0; // short
19
    public $frameMax = 0; // long
20
    public $heartbeat = 0; // short
21
22
    public static function create(
23
        $channelMax = null, $frameMax = null, $heartbeat = null
24
    )
25
    {
26
        $frame = new self();
27
28
        if (null !== $channelMax) {
29
            $frame->channelMax = $channelMax;
30
        }
31
        if (null !== $frameMax) {
32
            $frame->frameMax = $frameMax;
33
        }
34
        if (null !== $heartbeat) {
35
            $frame->heartbeat = $heartbeat;
36
        }
37
38
        return $frame;
39
    }
40
}
41