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.
Passed
Push — master ( c07b11...b289ea )
by Toby
27:25 queued 11s
created

IdRetriever::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
namespace BristolSU\ControlDB\Export\Handler\Airtable;
5
6
7
use BristolSU\ControlDB\Contracts\Models\Group;
8
use BristolSU\ControlDB\Contracts\Models\Role;
9
use BristolSU\ControlDB\Contracts\Models\User;
10
use BristolSU\ControlDB\Export\FormattedItem;
11
use Illuminate\Contracts\Cache\Repository;
12
use Illuminate\Support\Collection;
13
14
class IdRetriever
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class IdRetriever
Loading history...
15
{
16
17
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
18
     * @var Repository
19
     */
20
    private Repository $cache;
0 ignored issues
show
Coding Style introduced by
Private member variable "cache" must be prefixed with an underscore
Loading history...
21
    private $baseId;
0 ignored issues
show
Coding Style introduced by
Private member variable "baseId" must be prefixed with an underscore
Loading history...
22
    private $tableName;
0 ignored issues
show
Coding Style introduced by
Private member variable "tableName" must be prefixed with an underscore
Loading history...
23
24 8
    public function __construct(Repository $cache, $baseId, $tableName)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
25
    {
26 8
        $this->cache = $cache;
27 8
        $this->baseId = $baseId;
28 8
        $this->tableName = $tableName;
29 8
    }
30
31 7
    public function ids(): Collection
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function ids()
Loading history...
32
    {
33 7
        return collect(
34 7
            $this->cache->get($this->key())
35
        );
36
    }
37
38 7
    public function saveIds($ids)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function saveIds()
Loading history...
39
    {
40 7
        if($ids instanceof Collection) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
41 4
            $ids = $ids->toArray();
42
        }
43 7
        $this->cache->forever($this->key(), $ids);
44 7
    }
45
    
46 1
    public function pushIds(array $ids): void
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function pushIds()
Loading history...
47
    {
48 1
        $currentIds = $this->ids();
49 1
        $this->saveIds($currentIds->concat($ids));
50 1
    }
51
52 3
    public function pushId(string $id): void
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function pushId()
Loading history...
53
    {
54 3
        $currentIds = $this->ids();
55 3
        $currentIds->push($id);
56 3
        $this->saveIds($currentIds);
57 3
    }
58
59 8
    private function key()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function key()
Loading history...
Coding Style introduced by
Private method name "IdRetriever::key" must be prefixed with an underscore
Loading history...
60
    {
61 8
        return static::class . ':' . $this->baseId . ':' . $this->tableName;
62
    }
63
64
}