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

Content::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace ButterAMQP\AMQP091\Framing;
4
5
/**
6
 * @codeCoverageIgnore
7
 */
8
class Content extends Frame
9
{
10
    /**
11
     * @var string
12
     */
13
    private $data;
14
15
    /**
16
     * @param int    $channel
17
     * @param string $data
18
     */
19
    public function __construct($channel, $data)
20
    {
21
        $this->data = $data;
22
23
        parent::__construct($channel);
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function getData()
30
    {
31
        return $this->data;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function encode()
38
    {
39
        return "\x03".pack('nN', $this->channel, strlen($this->data)).$this->data."\xCE";
40
    }
41
}
42