Completed
Push — master ( de1e8d...6457e8 )
by Nathan
02:33
created

GetBlockSubsidy::jsonSerialize()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace ZenCash\Rpc\Command\Mining;
4
5
use ZenCash\Rpc\Command;
6
7
class GetBlockSubsidy implements Command
8
{
9
    private const METHOD = 'getblocksubsidy';
10
    private $height;
11
12
    public function __construct(?int $height)
13
    {
14
        $this->height = $height;
15
    }
16
17
    public function jsonSerialize(): object
18
    {
19
        return (object) array_merge([
20
            'jsonrpc' => Command::JSON_RPC_VERSION,
21
            'id'      => Command::ID,
22
            'method'  => self::METHOD
23
        ], !is_null($this->height) ? [
24
            'params' => [
25
                $this->height
26
            ]
27
        ] : []);
28
    }
29
}
30