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

SupplierTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 71.43%

Importance

Changes 7
Bugs 3 Features 1
Metric Value
wmc 2
c 7
b 3
f 1
lcom 0
cbo 3
dl 0
loc 37
ccs 5
cts 7
cp 0.7143
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A includePurchases() 0 4 1
A transform() 0 8 1
1
<?php
2
3
namespace App\Transformers;
4
5
use App\Supplier;
6
use League\Fractal\TransformerAbstract;
7
8
class SupplierTransformer extends TransformerAbstract
9
{
10
    /**
11
     * List of resources possible to include.
12
     *
13
     * @var array
14
     */
15
    protected $availableIncludes = ['purchases'];
16
17
    /**
18
     * Turn this item object into a generic array.
19
     *
20
     * @param Supplier $supplier
21
     *
22
     * @return array
23
     */
24 1
    public function transform(Supplier $supplier)
25
    {
26
        return [
27 1
            'id'       => (int) $supplier->id,
28 1
            'name'     => (string) $supplier->name,
29 1
            'location' => (string) $supplier->location,
30 1
        ];
31
    }
32
33
    /**
34
     * Includes purchases.
35
     *
36
     * @param Supplier $supplier
37
     *
38
     * @return \League\Fractal\Resource\Collection
39
     */
40
    public function includePurchases(Supplier $supplier)
41
    {
42
        return $this->collection($supplier->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...
43
    }
44
}
45