JsonRpcCall   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 53
ccs 12
cts 12
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A isBatch() 0 3 1
A getItemList() 0 3 1
A addExceptionItem() 0 5 1
A addRequestItem() 0 5 1
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