Completed
Pull Request — master (#1)
by Sergey
04:51
created

BasicAck::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
/*
3
 * This file is automatically generated.
4
 */
5
6
namespace ButterAMQP\AMQP091\Framing\Method;
7
8
use ButterAMQP\AMQP091\Framing\Frame;
9
use ButterAMQP\Value;
10
11
/**
12
 * Acknowledge one or more messages.
13
 *
14
 * @codeCoverageIgnore
15
 */
16 View Code Duplication
class BasicAck 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 int
20
     */
21
    private $deliveryTag;
22
23
    /**
24
     * @var bool
25
     */
26
    private $multiple;
27
28
    /**
29
     * @param int  $channel
30
     * @param int  $deliveryTag
31
     * @param bool $multiple
32
     */
33
    public function __construct($channel, $deliveryTag, $multiple)
34
    {
35
        $this->deliveryTag = $deliveryTag;
36
        $this->multiple = $multiple;
37
38
        parent::__construct($channel);
39
    }
40
41
    /**
42
     * DeliveryTag.
43
     *
44
     * @return int
45
     */
46
    public function getDeliveryTag()
47
    {
48
        return $this->deliveryTag;
49
    }
50
51
    /**
52
     * Acknowledge multiple messages.
53
     *
54
     * @return bool
55
     */
56
    public function isMultiple()
57
    {
58
        return $this->multiple;
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function encode()
65
    {
66
        $data = "\x00\x3C\x00\x50".
67
            Value\LongLongValue::encode($this->deliveryTag).
68
            Value\BooleanValue::encode($this->multiple);
69
70
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
71
    }
72
}
73