Completed
Push — master ( 11795b...abede7 )
by Nathan
02:11
created

Amount::jsonSerialize()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace ZenCash\Rpc\Command\Wallet\ZSendMany;
4
5
final class Amount implements \JsonSerializable
6
{
7
    private $address;
8
    private $amount;
9
    private $memo;
10
11 3
    public function __construct(string $address, float $amount, ?string $memo)
12
    {
13 3
        $this->address = $address;
14 3
        $this->amount = $amount;
15 3
        $this->memo = $memo;
16 3
    }
17
18 2
    public function jsonSerialize(): object
19
    {
20 2
        return (object) array_merge([
21 2
            'address' => $this->address,
22 2
            'amount' => $this->amount
23 2
        ], !is_null($this->memo) ? [ 'memo' => $this->memo ] : [ ]);
24
    }
25
}
26