NotificationObject::getMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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