Completed
Pull Request — master (#387)
by thomas
249:34 queued 246:57
created

SigHash::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BitWasp\Bitcoin\Transaction\SignatureHash;
4
5
use BitWasp\Bitcoin\Script\ScriptInterface;
6
use BitWasp\Bitcoin\Transaction\TransactionInterface;
7
8
abstract class SigHash implements SigHashInterface
9
{
10
    const V0 = 0;
11
    const V1 = 1;
12
    
13
    /**
14
     * @var TransactionInterface
15
     */
16
    protected $tx;
17
18
    /**
19
     * SigHash constructor.
20
     * @param TransactionInterface $transaction
21
     */
22 386
    public function __construct(TransactionInterface $transaction)
23
    {
24 386
        $this->tx = $transaction;
25 386
    }
26
27
    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...
28
}
29