Total Complexity | 7 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Coverage | 94.12% |
Changes | 0 |
1 | <?php |
||
12 | class TransactionOutput extends Serializable implements TransactionOutputInterface |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | private $value; |
||
19 | |||
20 | /** |
||
21 | * @var ScriptInterface |
||
22 | */ |
||
23 | private $script; |
||
24 | |||
25 | /** |
||
26 | * Initialize class |
||
27 | * |
||
28 | * @param int $value |
||
29 | * @param ScriptInterface $script |
||
30 | */ |
||
31 | 5212 | public function __construct(int $value, ScriptInterface $script) |
|
32 | { |
||
33 | 5212 | if ($value < 0) { |
|
34 | throw new \RuntimeException('Transaction output value cannot be negative'); |
||
35 | } |
||
36 | 5212 | $this->value = $value; |
|
37 | 5212 | $this->script = $script; |
|
38 | 5212 | } |
|
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | * @see TransactionOutputInterface::getValue() |
||
43 | */ |
||
44 | 5298 | public function getValue(): int |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | * @see TransactionOutputInterface::getScript() |
||
52 | */ |
||
53 | 5295 | public function getScript(): ScriptInterface |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | * @see TransactionOutputInterface::equals() |
||
61 | */ |
||
62 | 9 | public function equals(TransactionOutputInterface $output): bool |
|
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | * @see \BitWasp\Bitcoin\SerializableInterface::getBuffer() |
||
75 | */ |
||
76 | 1 | public function getBuffer(): BufferInterface |
|
81 |