Completed
Push — master ( 838d3a...3b658f )
by thomas
22:41 queued 01:10
created

Operation::isPush()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace BitWasp\Bitcoin\Script\Parser;
4
5
use BitWasp\Bitcoin\Script\Opcodes;
6
use BitWasp\Buffertools\Buffer;
7
8
class Operation
9
{
10
    /**
11
     * @var bool
12
     */
13
    private $push;
14
15
    /**
16
     * @var int
17
     */
18
    private $opCode;
19
20
    /**
21
     * @var Buffer|null
22
     */
23
    private $pushData;
24
25
    /**
26
     * ScriptExec constructor.
27
     * @param $opCode
28
     * @param Buffer|null $pushData
29
     */
30 1035
    public function __construct($opCode, Buffer $pushData = null)
31
    {
32 1035
        $this->push = $opCode >= 0 && $opCode <= Opcodes::OP_PUSHDATA4;
33 1035
        $this->opCode = $opCode;
34 1035
        $this->pushData = $pushData;
35 1035
    }
36
37
    /**
38
     * @return bool
39
     */
40 90
    public function isPush()
41
    {
42 90
        return $this->push;
43
    }
44
45
    /**
46
     * @return int
47
     */
48 993
    public function getOp()
49
    {
50 993
        return $this->opCode;
51
    }
52
53
    /**
54
     * @return Buffer|null
55
     */
56 987
    public function getData()
57
    {
58 987
        return $this->pushData;
59
    }
60
}
61