Answer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setResponse() 0 4 1
A getContent() 0 8 3
1
<?php
2
3
namespace kalanis\RemoteRequest\Protocols\Dummy;
4
5
6
/**
7
 * Class Answer
8
 * @package kalanis\RemoteRequest\Protocols\Dummy
9
 * Process server's answer - raw edition
10
 */
11
class Answer
12
{
13
    /** @var resource|string|null */
14
    protected $body = null;
15
16
    /**
17
     * @param resource|string|null $message
18
     * @return $this
19
     */
20 19
    public function setResponse($message): self
21
    {
22 19
        $this->body = $message;
23 19
        return $this;
24
    }
25
26 12
    public function getContent(): string
27
    {
28 12
        return is_null($this->body)
29 4
            ? ''
30 12
            : (
31 9
                is_resource($this->body)
32 9
                ? strval(stream_get_contents($this->body, -1, 0))
33 12
                : strval($this->body)
34 12
            )
35 12
        ;
36
    }
37
}
38