AddNode   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 19
c 0
b 0
f 0
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 7 1
A __construct() 0 4 1
1
<?php
2
3
namespace ZenCash\Rpc\Command\Network;
4
5
use ZenCash\Rpc\Command;
6
use ZenCash\Rpc\Command\Network\AddNode\Command as CommandEnum;
7
8
final class AddNode implements Command
9
{
10
    private const METHOD = 'addnode';
11
    private $node;
12
    private $command;
13
14 1
    public function __construct(string $node, CommandEnum $command)
15
    {
16 1
        $this->node = $node;
17 1
        $this->command = $command;
18 1
    }
19
20 1
    public function jsonSerialize(): object
21
    {
22
        return (object) [
23 1
            'jsonrpc' => Command::JSON_RPC_VERSION,
24
            'id'      => Command::ID,
25 1
            'method'  => self::METHOD,
26 1
            'params' => [ $this->node, (string) $this->command ]
27
        ];
28
    }
29
}
30