Tx   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 39
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getNetworkCommand() 0 3 1
A getTransaction() 0 3 1
A __construct() 0 3 1
A getBuffer() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Bitcoin\Networking\Messages;
6
7
use BitWasp\Bitcoin\Networking\Message;
8
use BitWasp\Bitcoin\Networking\NetworkSerializable;
9
use BitWasp\Buffertools\BufferInterface;
10
11
class Tx extends NetworkSerializable
12
{
13
    /**
14
     * Tx describes a bitcoin transaction, in reply to getdata
15
     *
16
     * @var BufferInterface
17
     */
18
    private $transaction;
19 6
20
    public function __construct(BufferInterface $tx)
21 6
    {
22 6
        $this->transaction = $tx;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     * @see https://en.bitcoin.it/wiki/Protocol_documentation#tx
28 6
     * @see \BitWasp\Bitcoin\Network\NetworkSerializableInterface::getNetworkCommand()
29
     */
30 6
    public function getNetworkCommand(): string
31
    {
32
        return Message::TX;
33
    }
34
35
    /**
36 3
     * @return BufferInterface
37
     */
38 3
    public function getTransaction(): BufferInterface
39
    {
40
        return $this->transaction;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45 6
     * @see \BitWasp\Bitcoin\SerializableInterface::getBuffer()
46
     */
47 6
    public function getBuffer(): BufferInterface
48
    {
49
        return $this->transaction;
50
    }
51
}
52