Failed Conditions
Pull Request — release/3.0.0 (#37)
by Yo
01:46
created

JsonRpcRawRequest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A addRequestItem() 0 5 1
A getItemtList() 0 3 1
A __construct() 0 3 1
A isBatch() 0 3 1
A addExceptionItem() 0 5 1
1
<?php
2
namespace Yoanm\JsonRpcServer\Infra\RawObject;
3
4
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcRequest;
5
6
/**
7
 * Class JsonRpcRawRequest
8
 */
9
class JsonRpcRawRequest
10
{
11
    /** @var bool */
12
    private $isBatch;
13
    /** @var mixed[] */
14
    private $itemList = [];
15
16
    /**
17
     * @param bool|false $isBatch
18
     */
19
    public function __construct(bool $isBatch = false)
20
    {
21
        $this->isBatch = $isBatch;
22
    }
23
24
    /**
25
     * @param JsonRpcRequest $item
26
     *
27
     * @return JsonRpcRawRequest
28
     */
29
    public function addRequestItem(JsonRpcRequest $item) : JsonRpcRawRequest
30
    {
31
        $this->itemList[] = $item;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @param \Exception $item
38
     *
39
     * @return JsonRpcRawRequest
40
     */
41
    public function addExceptionItem(\Exception $item) : JsonRpcRawRequest
42
    {
43
        $this->itemList[] = $item;
44
45
        return $this;
46
    }
47
48
    /**
49
     * @return boolean
50
     */
51
    public function isBatch() : bool
52
    {
53
        return $this->isBatch;
54
    }
55
56
    /**
57
     * @return (JsonRpcRequest|\Exception)[]
58
     */
59
    public function getItemtList() : array
60
    {
61
        return $this->itemList;
62
    }
63
}
64