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

Base58Address   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAddress() 0 6 2
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