Failed Conditions
Push — feature/init ( 86e8fd...b75bd4 )
by Yo
03:41 queued 47s
created

JsonRpcRawResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addResponse() 0 5 1
A getResponseList() 0 3 1
A isBatch() 0 3 1
A __construct() 0 3 1
1
<?php
2
namespace Yoanm\JsonRpcServer\Infra\RawObject;
3
4
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcResponse;
5
6
/**
7
 * Class JsonRpcRawResponse
8
 */
9
class JsonRpcRawResponse
10
{
11
    /** @var bool */
12
    private $isBatch;
13
    /** @var JsonRpcResponse[] */
14
    private $responseList = [];
15
16
    /**
17
     * @param bool $isBatch
18
     */
19
    public function __construct(bool $isBatch = false)
20
    {
21
        $this->isBatch = $isBatch;
22
    }
23
24
    /**
25
     * @param JsonRpcResponse $response
26
     *
27
     * @return JsonRpcRawResponse
28
     */
29
    public function addResponse(JsonRpcResponse $response) : JsonRpcRawResponse
30
    {
31
        $this->responseList[] = $response;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @return boolean
38
     */
39
    public function isBatch() : bool
40
    {
41
        return $this->isBatch;
42
    }
43
44
    /**
45
     * @return JsonRpcResponse[]
46
     */
47
    public function getResponseList() : array
48
    {
49
        return $this->responseList;
50
    }
51
}
52