Passed
Pull Request — master (#2)
by Sergey
04:32
created

RpcRequest::getParamsObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Onnov\JsonRpcServer\Model;
6
7
use stdClass;
8
9
class RpcRequest
10
{
11
    /** @var int|string|null */
12
    private $id;
13
14
    /** @var string */
15
    private $method;
16
17
    /** @var mixed[]|stdClass|null */
18
    private $params;
19
20
    /**
21
     * parameters in a custom php object
22
     *
23
     * @var object|null
24
     */
25
    private $paramsObject;
26
27
    /**
28
     * RpcRequest constructor.
29
     *
30
     * @param RpcModel $validRpc
31
     * @param object|null $paramsObject
32
     */
33 2
    public function __construct(RpcModel $validRpc, ?object $paramsObject = null)
34
    {
35 2
        $this->id = $validRpc->getId();
36 2
        $this->method = $validRpc->getMethod();
37 2
        $this->params = $validRpc->getParams();
38 2
        $this->paramsObject = $paramsObject;
39 2
    }
40
41
    /**
42
     * @return int|string|null
43
     */
44
    public function getId()
45
    {
46
        return $this->id;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getMethod(): string
53
    {
54
        return $this->method;
55
    }
56
57
    /**
58
     * @return mixed[]|stdClass|null
59
     */
60
    public function getParams()
61
    {
62
        return $this->params;
63
    }
64
65
    /**
66
     * @return object|null
67
     */
68
    public function getParamsObject(): ?object
69
    {
70
        return $this->paramsObject;
71
    }
72
}
73