Passed
Pull Request — master (#14)
by Nicolas
04:12
created

Binary   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 88.24%

Importance

Changes 0
Metric Value
dl 0
loc 38
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0
ccs 15
cts 17
cp 0.8824
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getContentType() 0 4 1
A __toString() 0 7 1
A inOriginalFormat() 0 4 1
A asTransported() 0 4 1
A changeContent() 0 4 1
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
        $content;
1 ignored issue
show
Coding Style introduced by
The visibility should be declared for property $content.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
12
    
13 2
    public function __construct($content)
14
    {
15 2
        $this->changeContent($content);
16 2
    }
17
    
18 1
    public function inOriginalFormat()
19
    {
20 1
        return $this->content;
21
    }
22
    
23
    public function asTransported()
24
    {
25
        return $this->content;
26
    }
27
    
28 1
    public function getContentType()
29
    {
30 1
        return ContentType::BINARY;
31
    }
32
    
33 1
    public function __toString()
34
    {
35 1
        return sprintf(
36 1
            '<binary stream of %d bytes>',
37 1
            strlen($this->content)
38 1
        );
39
    }
40
    
41 2
    public function changeContent($content)
42
    {
43 2
        $this->content = $content;
44 2
    }
45
}
46