RawTransaction   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 21
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 6 3
1
<?php
2
3
namespace ZenCash\Rpc\Command\RawTransactions;
4
5
final class RawTransaction implements \JsonSerializable
6
{
7
    private $txid;
8
    private $vout;
9
    private $scriptPubKey;
10
    private $redeemScript;
11
12 9
    public function __construct(string $txid, int $vout, ?string $scriptPubKey, ?string $redeemScript)
13
    {
14 9
        $this->txid = $txid;
15 9
        $this->vout = $vout;
16 9
        $this->scriptPubKey = $scriptPubKey;
17 9
        $this->redeemScript = $redeemScript;
18 9
    }
19
20 5
    public function jsonSerialize(): object
21
    {
22 5
        return (object) array_merge(
23 5
            [ 'txid' => $this->txid, 'vout' => $this->vout ],
24 5
            !is_null($this->scriptPubKey) ? [ 'scriptPubKey' => $this->scriptPubKey ] : [ ],
25 5
            !is_null($this->redeemScript) ? [ 'redeemScript' => $this->redeemScript ] : [ ]
26
        );
27
    }
28
}
29