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 BasicConsumeFrame |
10
|
|
|
* @author Aleksey I. Kuleshov YOU GLOBAL LIMITED |
11
|
|
|
* @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic |
12
|
|
|
*/ |
13
|
|
View Code Duplication |
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
|
|
|
|
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.