Failed Conditions
Pull Request — release/3.0.0-dev (#32)
by Yo
02:02
created

JsonRpcCall::addRequestItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace Yoanm\JsonRpcServer\Domain\Model;
3
4
/**
5
 * Class JsonRpcCall
6
 */
7
class JsonRpcCall
8
{
9
    /** @var bool */
10
    private $isBatch;
11
    /** @var mixed[] */
12
    private $itemList = [];
13
14
    /**
15
     * @param bool|false $isBatch
16
     */
17 2
    public function __construct(bool $isBatch = false)
18
    {
19 2
        $this->isBatch = $isBatch;
20 2
    }
21
22
    /**
23
     * @param JsonRpcRequest $item
24
     *
25
     * @return JsonRpcCall
26
     */
27 1
    public function addRequestItem(JsonRpcRequest $item) : JsonRpcCall
28
    {
29 1
        $this->itemList[] = $item;
30
31 1
        return $this;
32
    }
33
34
    /**
35
     * @param \Exception $item
36
     *
37
     * @return JsonRpcCall
38
     */
39 1
    public function addExceptionItem(\Exception $item) : JsonRpcCall
40
    {
41 1
        $this->itemList[] = $item;
42
43 1
        return $this;
44
    }
45
46
    /**
47
     * @return boolean
48
     */
49 1
    public function isBatch() : bool
50
    {
51 1
        return $this->isBatch;
52
    }
53
54
    /**
55
     * @return (JsonRpcRequest|\Exception)[]
56
     */
57 1
    public function getItemList() : array
58
    {
59 1
        return $this->itemList;
60
    }
61
}
62