NullEncoder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A encode() 0 8 2
1
<?php
2
3
namespace Vectorface\SnappyRouter\Encoder;
4
5
use Vectorface\SnappyRouter\Response\AbstractResponse;
6
7
/**
8
 * An encoder that simply returns the response object directly.
9
 * @copyright Copyright (c) 2014, VectorFace, Inc.
10
 * @author Dan Bruce <[email protected]>
11
 */
12
class NullEncoder extends AbstractEncoder
13
{
14
    /**
15
     * @param AbstractResponse $response The response to be encoded.
16
     * @return string Returns the response encoded as a string.
17
     */
18 5
    public function encode(AbstractResponse $response)
19
    {
20 5
        if (is_string($response->getResponseObject())) {
21 4
            return $response->getResponseObject();
22
        } else {
23 1
            return '';
24
        }
25
    }
26
}
27