Completed
Pull Request — master (#517)
by thomas
72:19
created

Base58Address::getAddress()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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