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

RpcRequest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 38.46%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 68
ccs 5
cts 13
cp 0.3846
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getParamsObject() 0 3 1
A getId() 0 3 1
A __construct() 0 6 1
A getMethod() 0 3 1
A getParams() 0 3 1
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