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

Operation   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A isPush() 0 4 1
A getOp() 0 4 1
A getData() 0 4 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