Test Failed
Pull Request — master (#9)
by Nicolas
03:28
created

Binary::decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Puzzle\AMQP\Messages\Bodies;
4
5
use Puzzle\AMQP\Messages\Body;
6
use Puzzle\AMQP\Messages\ContentType;
7
8
class Binary implements Body
9
{
10
    private
11
        $body;
12
    
13
    public function __construct($content)
14
    {
15
        $this->changeContent($content);
16
    }
17
    
18
    public function format()
19
    {
20
        return $this->body;
21
    }
22
    
23
    public function changeContent($content)
24
    {
25
        $this->body = $content;
26
    }
27
    
28
    public function getContentType()
29
    {
30
        return ContentType::BINARY;
31
    }
32
    
33
    public function __toString()
34
    {
35
        return sprintf(
36
            '<binary stream of %d bytes>',
37
            strlen($this->body)
38
        );
39
    }
40
    
41
    public function decode()
42
    {
43
        return $this->body;
44
    }
45
}
46