NetworkSerializable::getNetworkMessage()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Bitcoin\Networking;
6
7
use BitWasp\Bitcoin\Bitcoin;
8
use BitWasp\Bitcoin\Network\NetworkInterface;
9
use BitWasp\Bitcoin\Serializable;
10
11
abstract class NetworkSerializable extends Serializable implements NetworkSerializableInterface
12
{
13
    /**
14
     * @param NetworkInterface $network
15 93
     * @return NetworkMessage
16
     */
17 93
    public function getNetworkMessage(NetworkInterface $network = null): NetworkMessage
18 93
    {
19
        return new NetworkMessage(
20 62
            $network ?: Bitcoin::getNetwork(),
21
            $this
22
        );
23
    }
24
}
25