Completed
Pull Request — master (#387)
by thomas
247:48 queued 175:25
created

SigHash   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
calculate() 0 1 ?
1
<?php
2
3
namespace BitWasp\Bitcoin\Transaction\SignatureHash;
4
5
6
use BitWasp\Bitcoin\Script\ScriptInterface;
7
use BitWasp\Bitcoin\Transaction\TransactionInterface;
8
9
abstract class SigHash implements SigHashInterface
10
{
11
    const V0 = 0;
12
    const V1 = 1;
13
    
14
    /**
15
     * @var TransactionInterface
16
     */
17
    protected $tx;
18
19
    /**
20
     * SigHash constructor.
21
     * @param TransactionInterface $transaction
22
     */
23
    public function __construct(TransactionInterface $transaction)
24
    {
25
        $this->tx = $transaction;
26
    }
27
28
    abstract public function calculate(ScriptInterface $txOutScript, $inputToSign, $sighashType = SigHash::ALL);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
29
}