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

Block   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBuffer() 0 3 1
A getNetworkCommand() 0 3 1
A __construct() 0 3 1
A getBlockData() 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 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