Completed
Pull Request — master (#239)
by thomas
49:01 queued 45:29
created

WitnessProgram::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace BitWasp\Bitcoin\Script;
4
5
use BitWasp\Buffertools\BufferInterface;
6
7
class WitnessProgram
8
{
9
    /**
10
     * @var int
11
     */
12
    private $version;
13
14
    /**
15
     * @var BufferInterface
16
     */
17
    private $program;
18
19
    /**
20
     * WitnessProgram constructor.
21
     * @param int $version
22
     * @param BufferInterface $program
23
     */
24
    public function __construct($version, BufferInterface $program)
25
    {
26
        $this->version = $version;
27
        $this->program = $program;
28
    }
29
30
    /**
31
     * @return int
32
     */
33
    public function getVersion()
34
    {
35
        return $this->version;
36
    }
37
38
    /**
39
     * @return BufferInterface
40
     */
41
    public function getProgram()
42
    {
43
        return $this->program;
44
    }
45
46
    /**
47
     * @return ScriptInterface
48
     */
49
    public function getScript()
50
    {
51
        return ScriptFactory::create()
52
            ->int($this->version)
53
            ->push($this->program)
54
            ->getScript();
55
    }
56
}
57