Passed
Pull Request — master (#98)
by thomas
03:01
created

Block::getBlockData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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 Block extends NetworkSerializable
12
{
13
    /**
14
     * @var BufferInterface
15
     */
16
    private $blockData;
17
18
    public function __construct(BufferInterface $blockData)
19 6
    {
20
        $this->blockData = $blockData;
21 6
    }
22 6
23
    /**
24
     * {@inheritdoc}
25
     * @see https://en.bitcoin.it/wiki/Protocol_documentation#block
26
     * @see \BitWasp\Bitcoin\Network\NetworkSerializableInterface::getNetworkCommand()
27
     */
28 6
    public function getNetworkCommand(): string
29
    {
30 6
        return Message::BLOCK;
31
    }
32
33
    /**
34
     * @return BufferInterface
35
     */
36 3
    public function getBlockData(): BufferInterface
37
    {
38 3
        return $this->blockData;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     * @see \BitWasp\Bitcoin\SerializableInterface::getBuffer()
44
     */
45 6
    public function getBuffer(): BufferInterface
46
    {
47 6
        return $this->blockData;
48
    }
49
}
50