JsonRpcCall::__construct()   A
last analyzed

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 1
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\Domain\Model;
3
4
/**
5
 * Class JsonRpcCall
6
 */
7
class JsonRpcCall
8
{
9
    /** @var bool */
10
    private $isBatch;
11
    /** @var (JsonRpcRequest|\Exception)[] */
12
    private $itemList = [];
13
14
    /**
15
     * @param bool $isBatch
16
     */
17 34
    public function __construct(bool $isBatch = false)
18
    {
19 34
        $this->isBatch = $isBatch;
20
    }
21
22
    /**
23
     * @param JsonRpcRequest $item
24
     *
25
     * @return self
26
     */
27 22
    public function addRequestItem(JsonRpcRequest $item) : self
28
    {
29 22
        $this->itemList[] = $item;
30
31 22
        return $this;
32
    }
33
34
    /**
35
     * @param \Exception $item
36
     *
37
     * @return self
38
     */
39 6
    public function addExceptionItem(\Exception $item) : self
40
    {
41 6
        $this->itemList[] = $item;
42
43 6
        return $this;
44
    }
45
46
    /**
47
     * @return bool
48
     */
49 33
    public function isBatch() : bool
50
    {
51 33
        return $this->isBatch;
52
    }
53
54
    /**
55
     * @return (JsonRpcRequest|\Exception)[]
56
     */
57 25
    public function getItemList() : array
58
    {
59 25
        return $this->itemList;
60
    }
61
}
62