Passed
Push — master ( 12bb50...fde0da )
by Aranea
36:18 queued 21:19
created

HistoryController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AraneaDev\Electrum\App\Api;
4
5
use AraneaDev\Electrum\Electrum;
6
use App\Http\Controllers\Controller;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
9
 * Class HistoryController.
10
 */
11
class HistoryController extends Controller
12
{
13
    /** @var Electrum */
14
    protected $electrum;
15
16
    /**
17
     * HistoryController constructor.
18
     *
19
     * @param Electrum $electrum
20
     */
21
    public function __construct(Electrum $electrum)
22
    {
23
        $this->electrum = $electrum;
24
    }
25
26
    /**
27
     * Get the wallet history.
28
     *
29
     * @return \Illuminate\Http\JsonResponse
30
     */
31
    public function index()
32
    {
33
        return response()->json($this->electrum->getHistory());
0 ignored issues
show
Bug introduced by
The method json() does not exist on Symfony\Component\HttpFoundation\Response. It seems like you code against a sub-type of Symfony\Component\HttpFoundation\Response such as Illuminate\Http\RedirectResponse. ( Ignorable by Annotation )

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

33
        return response()->/** @scrutinizer ignore-call */ json($this->electrum->getHistory());
Loading history...
34
    }
35
36
    /**
37
     * Get the history for a specific address.
38
     *
39
     * @param $address
40
     *
41
     * @return \Illuminate\Http\JsonResponse
42
     */
43
    public function show($address)
44
    {
45
        return response()->json($this->electrum->getAddressHistory($address));
46
    }
47
48
    /**
49
     * Get transaction details.
50
     *
51
     * @param $txid
52
     *
53
     * @return object
54
     */
55
    public function details($txid)
56
    {
57
        return response()->json($this->electrum->getTransaction($txid));
0 ignored issues
show
Bug Best Practice introduced by
The expression return response()->json(...>getTransaction($txid)) returns the type Illuminate\Http\JsonResponse which is incompatible with the documented return type object.
Loading history...
58
    }
59
}
60