Completed
Push — master ( 26690c...ea008d )
by thomas
177:34 queued 174:51
created

SignData::p2sh()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace BitWasp\Bitcoin\Transaction\Factory;
4
5
use BitWasp\Bitcoin\Script\ScriptInterface;
6
7
class SignData
8
{
9
    /**
10
     * @var ScriptInterface
11
     */
12
    protected $redeemScript = null;
13
14
    /**
15
     * @var ScriptInterface
16
     */
17
    protected $witnessScript = null;
18
19
    /**
20
     * @param ScriptInterface $redeemScript
21
     * @return $this
22
     */
23 24
    public function p2sh(ScriptInterface $redeemScript)
24
    {
25 24
        $this->redeemScript = $redeemScript;
26 24
        return $this;
27
    }
28
29
    /**
30
     * @param ScriptInterface $witnessScript
31
     * @return $this
32
     */
33 18
    public function p2wsh(ScriptInterface $witnessScript)
34
    {
35 18
        $this->witnessScript = $witnessScript;
36 18
        return $this;
37
    }
38
39
    /**
40
     * @return ScriptInterface
41
     */
42 24
    public function getRedeemScript()
43
    {
44 24
        if (null === $this->redeemScript) {
45
            throw new \RuntimeException('Redeem script requested but not set');
46
        }
47
48 24
        return $this->redeemScript;
49
    }
50
51
    /**
52
     * @return ScriptInterface
53
     */
54 18
    public function getWitnessScript()
55
    {
56 18
        if (null === $this->witnessScript) {
57
            throw new \RuntimeException('Witness script requested but not set');
58
        }
59
60 18
        return $this->witnessScript;
61
    }
62
}
63