Completed
Pull Request — master (#386)
by thomas
112:49 queued 42:55
created

OutputData   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 62
ccs 0
cts 18
cp 0
rs 10
wmc 5
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getType() 0 4 1
A getScript() 0 4 1
A getSolution() 0 4 1
A canSign() 0 4 1
1
<?php
2
3
namespace BitWasp\Bitcoin\Script\Classifier;
4
5
use BitWasp\Bitcoin\Script\ScriptInterface;
6
7
class OutputData
8
{
9
    /**
10
     * @var string
11
     */
12
    private $type;
13
14
    /**
15
     * @var ScriptInterface
16
     */
17
    private $script;
18
19
    /**
20
     * @var mixed
21
     */
22
    private $solution;
23
24
    /**
25
     * OutputData constructor.
26
     * @param string $type
27
     * @param ScriptInterface $script
28
     * @param mixed $solution
29
     */
30
    public function __construct($type, ScriptInterface $script, $solution)
31
    {
32
        $this->type = $type;
33
        $this->script = $script;
34
        $this->solution = $solution;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getType()
41
    {
42
        return $this->type;
43
    }
44
45
    /**
46
     * @return ScriptInterface
47
     */
48
    public function getScript()
49
    {
50
        return $this->script;
51
    }
52
53
    /**
54
     * @return mixed
55
     */
56
    public function getSolution()
57
    {
58
        return $this->solution;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64
    public function canSign()
65
    {
66
        return in_array($this->type, [OutputClassifier::MULTISIG, OutputClassifier::PAYTOPUBKEY, OutputClassifier::PAYTOPUBKEYHASH]);
67
    }
68
}
69