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.

Transformer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace SebastianBerc\Repositories;
4
5
use Illuminate\Support\Collection;
6
use SebastianBerc\Repositories\Contracts\TransformerInterface;
7
8
/**
9
 * Class Transformer.
10
 *
11
 * @author    Sebastian Berć <[email protected]>
12
 * @copyright Copyright (c) Sebastian Berć
13
 */
14
abstract class Transformer implements TransformerInterface
15
{
16
    /**
17
     * Contains collection for transform.
18
     *
19
     * @var Collection
20
     */
21
    protected $collection;
22
23
    /**
24
     * Create new transformer instance with given collection of items.
25
     *
26
     * @param Collection $collection
27
     */
28 22
    public function __construct(Collection $collection)
29
    {
30 22
        $this->collection = $collection;
31 22
    }
32
33
    /**
34
     * Transform given item.
35
     *
36
     * @param mixed $item
37
     *
38
     * @return mixed
39
     */
40
    abstract public function transform($item);
41
42
    /**
43
     * Execute transform on each collection element given in contructor.
44
     *
45
     * @return Collection
46
     */
47
    public function execute()
48
    {
49 22
        return $this->collection->transform(function ($item) {
50 22
            return $this->transform($item);
51 22
        });
52
    }
53
}
54