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

Content   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getData() 0 4 1
A encode() 0 4 1
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