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   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 40
wmc 2
lcom 1
cbo 1
ccs 6
cts 6
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
transform() 0 1 ?
A execute() 0 6 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