GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (57668c)
by Nikhil
13:19 queued 05:38
created

PurchaseController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 58.33%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 4
dl 0
loc 38
ccs 7
cts 12
cp 0.5833
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 7 1
A show() 0 8 1
1
<?php
2
3
namespace App\Http\Controllers\API;
4
5
use App\Transformers\PurchaseTransformer;
6
use App\Purchase;
7
use Illuminate\Routing\Controller;
8
9
class PurchaseController extends Controller
10
{
11
    /**
12
     * PurchaseController constructor.
13
     */
14 2
    public function __construct()
15
    {
16 2
        $this->middleware('auth');
17 2
    }
18
19
    /**
20
     * Get all purchases.
21
     * @return array
22
     */
23 1
    public function all()
24
    {
25 1
        $purchases = Purchase::all();
26
27 1
        return fractal()->collection($purchases, new PurchaseTransformer)
28 1
                        ->toArray();
29
    }
30
31
    /**
32
     * Get the specified purchase.
33
     *
34
     * @param $id
35
     *
36
     * @return array
37
     */
38
    public function show($id)
39
    {
40
        $purchase = Purchase::findOrFail($id);
41
42
        return fractal()->item($purchase, new PurchaseTransformer)
43
                        ->parseIncludes(['guitars', 'supplier'])
44
                        ->toArray();
45
    }
46
}
47