Passed
Push — master ( ad1fbd...7f61ea )
by Russell
08:12 queued 12s
created

Bitcoin::verifyProof()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @author  Russell Michell 2018 <[email protected]>
5
 * @package silverstripe-verifiable
6
 */
7
8
namespace PhpTek\Verifiable\Backend\Blockchain;
9
10
/**
11
 * Class that models connection and verification requests made on and to the
12
 * Bitcoin network via the full-node software returned by the implementation()
13
 * method.
14
 */
15
class Bitcoin
16
{
17
    /**
18
     * Which full-node client software are we using to make requests back to the
19
     * Bitcoin network.
20
     *
21
     * @return string
22
     */
23
    public function implementation() : string
24
    {
25
        return 'bitcoind';
26
    }
27
28
    /**
29
     * @return bool
30
     */
31
    public function connect() : bool
32
    {
33
        // TODO
34
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return boolean. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
35
36
    /**
37
     * @return bool
38
     */
39
    public function verifyProof(string $proof) : bool
0 ignored issues
show
Unused Code introduced by
The parameter $proof is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

39
    public function verifyProof(/** @scrutinizer ignore-unused */ string $proof) : bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        // TODO
42
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return boolean. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
43
44
}
45