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 — develop ( e6912b...498113 )
by Toby
13:04
created

DataGroup   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Test Coverage

Coverage 73.32%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 11
c 1
b 0
f 0
dl 0
loc 77
ccs 11
cts 15
cp 0.7332
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getWhere() 0 3 1
A update() 0 3 1
A getById() 0 4 1
A create() 0 3 1
A getAllWhere() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Cache;
4
5
use BristolSU\ControlDB\Contracts\Repositories\DataGroup as DataGroupRepository;
6
use Illuminate\Contracts\Cache\Repository;
7
use Illuminate\Support\Collection;
8
9
class DataGroup implements DataGroupRepository
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DataGroup
Loading history...
10
{
11
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @var DataGroupRepository
14
     */
15
    private $dataGroupRepository;
0 ignored issues
show
Coding Style introduced by
Private member variable "dataGroupRepository" must be prefixed with an underscore
Loading history...
16
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
17
     * @var Repository
18
     */
19
    private $cache;
0 ignored issues
show
Coding Style introduced by
Private member variable "cache" must be prefixed with an underscore
Loading history...
20
21 15
    public function __construct(DataGroupRepository $dataGroupRepository, Repository $cache)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
22
    {
23 15
        $this->dataGroupRepository = $dataGroupRepository;
24 15
        $this->cache = $cache;
25 15
    }
26
27
    /**
28
     * Get a data group by ID
29
     *
30
     * @param int $id
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
31
     * @return \BristolSU\ControlDB\Contracts\Models\DataGroup
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
32
     */
33 13
    public function getById(int $id): \BristolSU\ControlDB\Contracts\Models\DataGroup
34
    {
35
        return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
36 13
            return $this->dataGroupRepository->getById($id);
37 13
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
38
    }
39
40
    /**
41
     * Get a data group where the given attributes match, including additional attributes.
42
     *
43
     * @param array $attributes
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
44
     * @return \BristolSU\ControlDB\Contracts\Models\DataGroup
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
45
     */
46
    public function getWhere($attributes = []): \BristolSU\ControlDB\Contracts\Models\DataGroup
47
    {
48
        return $this->dataGroupRepository->getWhere($attributes);
49
    }
50
    
51
    /**
52
     * Get all data groups where the given attributes match, including additional attributes.
53
     *
54
     * @param array $attributes
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
55
     * @return Collection|\BristolSU\ControlDB\Contracts\Models\DataGroup[]
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
56
     */
57
    public function getAllWhere($attributes = []): Collection
58
    {
59
        return $this->dataGroupRepository->getAllWhere($attributes);
60
    }
61
62
    /**
63
     * Create a data group with the given attributes
64
     *
65
     * @param string|null $name Name of the group
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter name; 1 found
Loading history...
66
     * @param string|null $email Email of the group
67
     *
68
     * @return \BristolSU\ControlDB\Contracts\Models\DataGroup
69
     */
70 2
    public function create(?string $name = null, ?string $email = null): \BristolSU\ControlDB\Contracts\Models\DataGroup
71
    {
72 2
        return $this->dataGroupRepository->create($name, $email);
73
    }
74
75
    /**
76
     * Update a group with the given attributes
77
     *
78
     * @param int $id
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 9 spaces after parameter type; 1 found
Loading history...
79
     * @param string|null $name Name of the group
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter name; 1 found
Loading history...
80
     * @param string|null $email Email of the group
81
     * @return \BristolSU\ControlDB\Contracts\Models\DataGroup
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
82
     */
83 4
    public function update(int $id, ?string $name = null, ?string $email = null): \BristolSU\ControlDB\Contracts\Models\DataGroup
84
    {
85 4
        return $this->dataGroupRepository->update($id, $name, $email);
86
    }
87
}