Code Duplication    Length = 45-45 lines in 2 locations

PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicConsumeFrame.php 1 location

@@ 13-57 (lines=45) @@
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic
12
 */
13
class BasicConsumeFrame implements MethodFrame, OutgoingFrame
14
{
15
    const METHOD_ID = 0x003c0014;
16
17
    public $frameChannelId = 0;
18
    public $reserved1 = 0; // short
19
    public $queue = ''; // shortstr
20
    public $consumerTag = ''; // shortstr
21
    public $noLocal = false; // bit
22
    public $noAck = false; // bit
23
    public $exclusive = false; // bit
24
    public $nowait = false; // bit
25
    public $arguments = []; // table
26
27
    public static function create(
28
        $queue = null, $consumerTag = null, $noLocal = null, $noAck = null, $exclusive = null, $nowait = null, $arguments = null
29
    )
30
    {
31
        $frame = new self();
32
33
        if (null !== $queue) {
34
            $frame->queue = $queue;
35
        }
36
        if (null !== $consumerTag) {
37
            $frame->consumerTag = $consumerTag;
38
        }
39
        if (null !== $noLocal) {
40
            $frame->noLocal = $noLocal;
41
        }
42
        if (null !== $noAck) {
43
            $frame->noAck = $noAck;
44
        }
45
        if (null !== $exclusive) {
46
            $frame->exclusive = $exclusive;
47
        }
48
        if (null !== $nowait) {
49
            $frame->nowait = $nowait;
50
        }
51
        if (null !== $arguments) {
52
            $frame->arguments = $arguments;
53
        }
54
55
        return $frame;
56
    }
57
}
58

PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeclareFrame.php 1 location

@@ 13-57 (lines=45) @@
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Queue
12
 */
13
class QueueDeclareFrame implements MethodFrame, OutgoingFrame
14
{
15
    const METHOD_ID = 0x0032000a;
16
17
    public $frameChannelId = 0;
18
    public $reserved1 = 0; // short
19
    public $queue = ''; // shortstr
20
    public $passive = false; // bit
21
    public $durable = false; // bit
22
    public $exclusive = false; // bit
23
    public $autoDelete = false; // bit
24
    public $nowait = false; // bit
25
    public $arguments = []; // table
26
27
    public static function create(
28
        $queue = null, $passive = null, $durable = null, $exclusive = null, $autoDelete = null, $nowait = null, $arguments = null
29
    )
30
    {
31
        $frame = new self();
32
33
        if (null !== $queue) {
34
            $frame->queue = $queue;
35
        }
36
        if (null !== $passive) {
37
            $frame->passive = $passive;
38
        }
39
        if (null !== $durable) {
40
            $frame->durable = $durable;
41
        }
42
        if (null !== $exclusive) {
43
            $frame->exclusive = $exclusive;
44
        }
45
        if (null !== $autoDelete) {
46
            $frame->autoDelete = $autoDelete;
47
        }
48
        if (null !== $nowait) {
49
            $frame->nowait = $nowait;
50
        }
51
        if (null !== $arguments) {
52
            $frame->arguments = $arguments;
53
        }
54
55
        return $frame;
56
    }
57
}
58