Completed
Push — master ( fdb7de...e17409 )
by Sergey
03:32
created

BasicCancelOk::encode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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
 * Confirm a cancelled consumer.
13
 *
14
 * @codeCoverageIgnore
15
 */
16
class BasicCancelOk extends Frame
17
{
18
    /**
19
     * @var string
20
     */
21
    private $consumerTag;
22
23
    /**
24
     * @param int    $channel
25
     * @param string $consumerTag
26
     */
27
    public function __construct($channel, $consumerTag)
28
    {
29
        $this->consumerTag = $consumerTag;
30
31
        parent::__construct($channel);
32
    }
33
34
    /**
35
     * ConsumerTag.
36
     *
37
     * @return string
38
     */
39
    public function getConsumerTag()
40
    {
41
        return $this->consumerTag;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function encode()
48
    {
49
        $data = "\x00\x3C\x00\x1F".
50
            Value\ShortStringValue::encode($this->consumerTag);
51
52
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
53
    }
54
}
55