Completed
Pull Request — master (#517)
by thomas
20:48
created

Base58Address::getAddress()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace BitWasp\Bitcoin\Address;
4
5
6
use BitWasp\Bitcoin\Base58;
7
use BitWasp\Bitcoin\Bitcoin;
8
use BitWasp\Bitcoin\Network\NetworkInterface;
9
use BitWasp\Buffertools\Buffer;
10
11
abstract class Base58Address extends Address implements Base58AddressInterface
12
{
13
    /**
14
     * @param NetworkInterface|null $network
15
     * @return string
16
     */
17 56
    public function getAddress(NetworkInterface $network = null)
18
    {
19 56
        $network = $network ?: Bitcoin::getNetwork();
20 56
        $payload = new Buffer($this->getPrefixByte($network) . $this->getHash()->getBinary());
21 56
        return Base58::encodeCheck($payload);
22
    }
23
}
24