Completed
Pull Request — feature/app (#10)
by Yo
07:12
created

JsonRpcRawResponse::isBatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 2
    public function __construct(bool $isBatch = false)
20
    {
21 2
        $this->isBatch = $isBatch;
22 2
    }
23
24
    /**
25
     * @param JsonRpcResponse $response
26
     *
27
     * @return JsonRpcRawResponse
28
     */
29 1
    public function addResponse(JsonRpcResponse $response) : JsonRpcRawResponse
30
    {
31 1
        $this->responseList[] = $response;
32
33 1
        return $this;
34
    }
35
36
    /**
37
     * @return boolean
38
     */
39 1
    public function isBatch() : bool
40
    {
41 1
        return $this->isBatch;
42
    }
43
44
    /**
45
     * @return JsonRpcResponse[]
46
     */
47 1
    public function getResponseList() : array
48
    {
49 1
        return $this->responseList;
50
    }
51
}
52