AddNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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