Completed
Pull Request — master (#526)
by thomas
83:42 queued 12:15
created

ScriptBranch::getScriptSections()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BitWasp\Bitcoin\Script\Path;
4
5
use BitWasp\Bitcoin\Script\ScriptInterface;
6
7
class ScriptBranch
8
{
9
    /**
10
     * @var ScriptInterface
11
     */
12
    private $fullScript;
13
14
    /**
15
     * @var array|\array[]
16
     */
17
    private $scriptSections;
18
19
    /**
20
     * @var array|\bool[]
21
     */
22
    private $branch;
23
24
    /**
25
     * ScriptBranch constructor.
26
     * @param ScriptInterface $fullScript
27
     * @param array $logicalPath
28
     * @param array $scriptSections
29
     */
30
    public function __construct(ScriptInterface $fullScript, array $logicalPath, array $scriptSections)
31
    {
32 154
        $this->fullScript = $fullScript;
33
        $this->branch = $logicalPath;
34 154
        $this->scriptSections = $scriptSections;
35 154
    }
36 154
37 154
    /**
38
     * @return array|\bool[]
39
     */
40
    public function getPath()
41
    {
42
        return $this->branch;
43
    }
44
45
    /**
46
     * @return array|\array[]
47
     */
48
    public function getScriptSections()
49
    {
50 154
        return $this->scriptSections;
51
    }
52 154
53
    /**
54
     * @return array
55
     */
56
    public function getOps()
57
    {
58 136
        $sequence = [];
59
        foreach ($this->getScriptSections() as $segment) {
60 136
            $sequence = array_merge($sequence, $segment);
61
        }
62
        return $sequence;
63
    }
64
}
65