Completed
Pull Request — master (#759)
by thomas
25:10
created

Creator::createPsbt()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 9
nc 4
nop 2
dl 0
loc 13
ccs 10
cts 10
cp 1
crap 3
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Bitcoin\Transaction\PSBT;
6
7
use BitWasp\Bitcoin\Transaction\TransactionInterface;
8
9
class Creator
10
{
11 2
    public function createPsbt(TransactionInterface $tx, array $unknowns = []): PSBT
12
    {
13 2
        $nIn = count($tx->getInputs());
14 2
        $inputs = [];
15 2
        for ($i = 0; $i < $nIn; $i++) {
16 2
            $inputs[] = new PSBTInput();
17
        }
18 2
        $nOut = count($tx->getOutputs());
19 2
        $outputs = [];
20 2
        for ($i = 0; $i < $nOut; $i++) {
21 2
            $outputs[] = new PSBTOutput();
22
        }
23 2
        return new PSBT($tx, $unknowns, $inputs, $outputs);
24
    }
25
}
26