Completed
Push — master ( 42bf17...fdb7de )
by Sergey
04:25
created

QueueDeclareOk::decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
/*
3
 * This file is automatically generated.
4
 */
5
6
namespace ButterAMQP\Framing\Method;
7
8
use ButterAMQP\Framing\Frame;
9
use ButterAMQP\Value;
10
11
/**
12
 * Confirms a queue definition.
13
 *
14
 * @codeCoverageIgnore
15
 */
16 View Code Duplication
class QueueDeclareOk extends Frame
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...
17
{
18
    /**
19
     * @var string
20
     */
21
    private $queue;
22
23
    /**
24
     * @var int
25
     */
26
    private $messageCount;
27
28
    /**
29
     * @var int
30
     */
31
    private $consumerCount;
32
33
    /**
34
     * @param int    $channel
35
     * @param string $queue
36
     * @param int    $messageCount
37
     * @param int    $consumerCount
38
     */
39
    public function __construct($channel, $queue, $messageCount, $consumerCount)
40
    {
41
        $this->queue = $queue;
42
        $this->messageCount = $messageCount;
43
        $this->consumerCount = $consumerCount;
44
45
        parent::__construct($channel);
46
    }
47
48
    /**
49
     * Queue.
50
     *
51
     * @return string
52
     */
53
    public function getQueue()
54
    {
55
        return $this->queue;
56
    }
57
58
    /**
59
     * MessageCount.
60
     *
61
     * @return int
62
     */
63
    public function getMessageCount()
64
    {
65
        return $this->messageCount;
66
    }
67
68
    /**
69
     * Number of consumers.
70
     *
71
     * @return int
72
     */
73
    public function getConsumerCount()
74
    {
75
        return $this->consumerCount;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function encode()
82
    {
83
        $data = "\x00\x32\x00\x0B".
84
            Value\ShortStringValue::encode($this->queue).
85
            Value\LongValue::encode($this->messageCount).
86
            Value\LongValue::encode($this->consumerCount);
87
88
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
89
    }
90
}
91