Code Duplication    Length = 32-33 lines in 4 locations

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

@@ 13-44 (lines=32) @@
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic
12
 */
13
class BasicReturnFrame implements MethodFrame, IncomingFrame
14
{
15
    const METHOD_ID = 0x003c0032;
16
17
    public $frameChannelId = 0;
18
    public $replyCode; // short
19
    public $replyText = ''; // shortstr
20
    public $exchange; // shortstr
21
    public $routingKey; // shortstr
22
23
    public static function create(
24
        $replyCode = null, $replyText = null, $exchange = null, $routingKey = null
25
    )
26
    {
27
        $frame = new self();
28
29
        if (null !== $replyCode) {
30
            $frame->replyCode = $replyCode;
31
        }
32
        if (null !== $replyText) {
33
            $frame->replyText = $replyText;
34
        }
35
        if (null !== $exchange) {
36
            $frame->exchange = $exchange;
37
        }
38
        if (null !== $routingKey) {
39
            $frame->routingKey = $routingKey;
40
        }
41
42
        return $frame;
43
    }
44
}
45

PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelCloseFrame.php 1 location

@@ 14-45 (lines=32) @@
11
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
12
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Channel
13
 */
14
class ChannelCloseFrame implements MethodFrame, IncomingFrame, OutgoingFrame
15
{
16
    const METHOD_ID = 0x00140028;
17
18
    public $frameChannelId = 0;
19
    public $replyCode; // short
20
    public $replyText = ''; // shortstr
21
    public $classId; // short
22
    public $methodId; // short
23
24
    public static function create(
25
        $replyCode = null, $replyText = null, $classId = null, $methodId = null
26
    )
27
    {
28
        $frame = new self();
29
30
        if (null !== $replyCode) {
31
            $frame->replyCode = $replyCode;
32
        }
33
        if (null !== $replyText) {
34
            $frame->replyText = $replyText;
35
        }
36
        if (null !== $classId) {
37
            $frame->classId = $classId;
38
        }
39
        if (null !== $methodId) {
40
            $frame->methodId = $methodId;
41
        }
42
43
        return $frame;
44
    }
45
}
46

PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionCloseFrame.php 1 location

@@ 14-45 (lines=32) @@
11
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
12
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Connection
13
 */
14
class ConnectionCloseFrame implements MethodFrame, IncomingFrame, OutgoingFrame
15
{
16
    const METHOD_ID = 0x000a0032;
17
18
    public $frameChannelId = 0;
19
    public $replyCode; // short
20
    public $replyText = ''; // shortstr
21
    public $classId; // short
22
    public $methodId; // short
23
24
    public static function create(
25
        $replyCode = null, $replyText = null, $classId = null, $methodId = null
26
    )
27
    {
28
        $frame = new self();
29
30
        if (null !== $replyCode) {
31
            $frame->replyCode = $replyCode;
32
        }
33
        if (null !== $replyText) {
34
            $frame->replyText = $replyText;
35
        }
36
        if (null !== $classId) {
37
            $frame->classId = $classId;
38
        }
39
        if (null !== $methodId) {
40
            $frame->methodId = $methodId;
41
        }
42
43
        return $frame;
44
    }
45
}
46

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

@@ 13-45 (lines=33) @@
10
 * @author Aleksey I. Kuleshov YOU GLOBAL LIMITED
11
 * @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Queue
12
 */
13
class QueueUnbindFrame implements MethodFrame, OutgoingFrame
14
{
15
    const METHOD_ID = 0x00320032;
16
17
    public $frameChannelId = 0;
18
    public $reserved1 = 0; // short
19
    public $queue = ''; // shortstr
20
    public $exchange; // shortstr
21
    public $routingKey = ''; // shortstr
22
    public $arguments = []; // table
23
24
    public static function create(
25
        $queue = null, $exchange = null, $routingKey = null, $arguments = null
26
    )
27
    {
28
        $frame = new self();
29
30
        if (null !== $queue) {
31
            $frame->queue = $queue;
32
        }
33
        if (null !== $exchange) {
34
            $frame->exchange = $exchange;
35
        }
36
        if (null !== $routingKey) {
37
            $frame->routingKey = $routingKey;
38
        }
39
        if (null !== $arguments) {
40
            $frame->arguments = $arguments;
41
        }
42
43
        return $frame;
44
    }
45
}
46