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.
Test Setup Failed
Push — master ( 273301...d40dfb )
by Nikhil
19:35 queued 09:51
created

MakeTransformer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 33.33%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 5
c 2
b 1
f 0
lcom 1
cbo 6
dl 0
loc 72
ccs 4
cts 12
cp 0.3333
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A transform() 0 7 1
A includeRacks() 0 4 1
A includeModels() 0 4 1
A includePurchases() 0 4 1
A includeGuitars() 0 4 1
1
<?php
2
3
namespace App\Transformers;
4
5
use App\Make;
6
use League\Fractal\TransformerAbstract;
7
8
class MakeTransformer extends TransformerAbstract
9
{
10
    /**
11
     * List of resources possible to include.
12
     *
13
     * @var array
14
     */
15
    protected $availableIncludes = ['racks', 'models', 'purchases', 'guitars'];
16
17
    /**
18
     * Turn this item object into a generic array.
19
     *
20
     * @param Make $make
21
     *
22
     * @return array
23
     */
24 1
    public function transform(Make $make)
25
    {
26
        return [
27 1
            'id'   => $make->id,
28 1
            'name' => $make->name,
29 1
        ];
30
    }
31
32
    /**
33
     * Include racks.
34
     *
35
     * @param Make $make
36
     *
37
     * @return \League\Fractal\Resource\Collection
38
     */
39
    public function includeRacks(Make $make)
40
    {
41
        return $this->collection($make->racks, new RackTransformer);
0 ignored issues
show
Documentation introduced by
new \App\Transformers\RackTransformer() is of type object<App\Transformers\RackTransformer>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
42
    }
43
44
    /**
45
     * Include models.
46
     *
47
     * @param Make $make
48
     *
49
     * @return \League\Fractal\Resource\Collection
50
     */
51
    public function includeModels(Make $make)
52
    {
53
        return $this->collection($make->models, new ModelTransformer);
0 ignored issues
show
Documentation introduced by
new \App\Transformers\ModelTransformer() is of type object<App\Transformers\ModelTransformer>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
54
    }
55
56
    /**
57
     * Include purchases.
58
     *
59
     * @param Make $make
60
     *
61
     * @return \League\Fractal\Resource\Collection
62
     */
63
    public function includePurchases(Make $make)
64
    {
65
        return $this->collection($make->purchases, new PurchaseTransformer);
0 ignored issues
show
Documentation introduced by
new \App\Transformers\PurchaseTransformer() is of type object<App\Transformers\PurchaseTransformer>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
66
    }
67
68
    /**
69
     * Include guitars.
70
     *
71
     * @param Make $make
72
     *
73
     * @return \League\Fractal\Resource\Collection
74
     */
75
    public function includeGuitars(Make $make)
76
    {
77
        return $this->collection($make->guitars, new GuitarTransformer);
0 ignored issues
show
Documentation introduced by
new \App\Transformers\GuitarTransformer() is of type object<App\Transformers\GuitarTransformer>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
78
    }
79
}
80