NotificationObject   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 14
c 0
b 0
f 0
dl 0
loc 41
ccs 14
cts 14
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A __construct() 0 4 1
A getProtocol() 0 3 1
A getParams() 0 3 1
A getId() 0 3 1
A jsonSerialize() 0 6 1
1
<?php
2
/*
3
 * This file is part of JSON RPC Client.
4
 *
5
 * (c) Igor Lazarev <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Strider2038\JsonRpcClient\Request;
12
13
/**
14
 * @author Igor Lazarev <[email protected]>
15
 */
16
class NotificationObject implements RequestObjectInterface, \JsonSerializable
17
{
18
    private string $jsonrpc = '2.0';
19
20
    private string $method;
21
22
    /** @var mixed */
23
    private $params;
24
25
    public function __construct(string $method, $params)
26
    {
27 14
        $this->method = $method;
28
        $this->params = $params;
29 14
    }
30 14
31 14
    public function getId()
32
    {
33 9
        return null;
34
    }
35 9
36
    public function getProtocol(): string
37
    {
38 1
        return $this->jsonrpc;
39
    }
40 1
41
    public function getMethod(): string
42
    {
43 1
        return $this->method;
44
    }
45 1
46
    public function getParams()
47
    {
48 1
        return $this->params;
49
    }
50 1
51
    public function jsonSerialize(): array
52
    {
53 13
        return [
54
            'jsonrpc' => $this->jsonrpc,
55
            'method'  => $this->method,
56 13
            'params'  => $this->params,
57 13
        ];
58 13
    }
59
}
60