Passed
Push — master ( 29c8e1...93d991 )
by Sergey
03:05
created

RpcRequest::getId()   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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
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
    /**
12
     * @var int|string|null 
13
     */
14
    private $id;
15
16
    /**
17
     * @var string 
18
     */
19
    private $method;
20
21
    /**
22
     * @var mixed[]|stdClass|null 
23
     */
24
    private $params;
25
26
    /**
27
     * parameters in a custom php object
28
     *
29
     * @var object|null
30
     */
31
    private $paramsObject;
32
33
    /**
34
     * RpcRequest constructor.
35
     *
36
     * @param RpcModel    $validRpc
37
     * @param object|null $paramsObject
38
     */
39 5
    public function __construct(RpcModel $validRpc, ?object $paramsObject = null)
40
    {
41 5
        $this->id = $validRpc->getId();
42 5
        $this->method = $validRpc->getMethod();
43 5
        $this->params = $validRpc->getParams();
44 5
        $this->paramsObject = $paramsObject;
45
    }
46
47
    /**
48
     * @return int|string|null
49
     */
50
    public function getId()
51
    {
52
        return $this->id;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getMethod(): string
59
    {
60
        return $this->method;
61
    }
62
63
    /**
64
     * @return mixed[]|stdClass|null
65
     */
66
    public function getParams()
67
    {
68
        return $this->params;
69
    }
70
71
    /**
72
     * @return object|null
73
     */
74
    public function getParamsObject(): ?object
75
    {
76
        return $this->paramsObject;
77
    }
78
}
79