Completed
Pull Request — master (#9)
by Nicolas
03:04
created

Binary::setBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Puzzle\AMQP\Messages;
4
5
use Puzzle\AMQP\WritableMessage;
6
7
class Binary extends Raw implements WritableMessage
8
{
9 1
    protected function initBody()
10
    {
11 1
        $this->body = null;
12 1
    }
13
    
14
    protected function formatBody()
15
    {
16
        return $this->body;
17
    }
18
    
19 1
    public function setBody($body)
20
    {
21 1
        $this->body = $body;
22
    
23 1
        return $this;
24
    }
25
    
26 1
    public function getContentType()
27
    {
28 1
        return ContentType::BINARY;
29
    }
30
    
31 1
    public function __toString()
32
    {
33 1
        return json_encode(array(
34 1
            'routing_key' => $this->getRoutingKey(),
35 1
            'body' => sprintf('<binary stream of %d bytes>', strlen($this->body)),
36 1
            'attributes' => $this->attributes,
0 ignored issues
show
Bug introduced by
The property attributes cannot be accessed from this context as it is declared private in class Puzzle\AMQP\Messages\Raw.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
37 1
            'flags' => $this->flags
0 ignored issues
show
Bug introduced by
The property flags cannot be accessed from this context as it is declared private in class Puzzle\AMQP\Messages\Raw.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
38 1
        ));
39
    }
40
}
41