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.

DataGroupNotifier   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Test Coverage

Coverage 78.95%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 14
c 1
b 0
f 0
dl 0
loc 75
ccs 15
cts 19
cp 0.7895
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 5 1
A getAllWhere() 0 3 1
A __construct() 0 4 1
A update() 0 6 1
A getWhere() 0 3 1
A getById() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Observers\NotifyObservers;
4
5
use BristolSU\ControlDB\Contracts\Repositories\DataGroup as DataGroupRepository;
6
use BristolSU\ControlDB\Observers\NotifyObservers\Framework\Notifier;
7
use BristolSU\ControlDB\Observers\NotifyObservers\Framework\ObserverStore;
8
use Illuminate\Support\Collection;
9
10
class DataGroupNotifier extends Notifier implements DataGroupRepository
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DataGroupNotifier
Loading history...
11
{
12
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @var DataGroupRepository
15
     */
16
    private $dataGroupRepository;
0 ignored issues
show
Coding Style introduced by
Private member variable "dataGroupRepository" must be prefixed with an underscore
Loading history...
17
18 15
    public function __construct(DataGroupRepository $dataGroupRepository, ObserverStore $observerStore)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
19
    {
20 15
        parent::__construct($observerStore, DataGroupRepository::class);
21 15
        $this->dataGroupRepository = $dataGroupRepository;
22 15
    }
23
24
    /**
25
     * Get a data group by ID
26
     *
27
     * @param int $id
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
28
     * @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...
29
     */
30 15
    public function getById(int $id): \BristolSU\ControlDB\Contracts\Models\DataGroup
31
    {
32 15
        return $this->dataGroupRepository->getById($id);
33
    }
34
35
    /**
36
     * Get a data group where the given attributes match, including additional attributes.
37
     *
38
     * @param array $attributes
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
39
     * @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...
40
     */
41
    public function getWhere($attributes = []): \BristolSU\ControlDB\Contracts\Models\DataGroup
42
    {
43
        return $this->dataGroupRepository->getWhere($attributes);
44
    }
45
46
    /**
47
     * Get all data groups where the given attributes match, including additional attributes.
48
     *
49
     * @param array $attributes
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
50
     * @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...
51
     */
52
    public function getAllWhere($attributes = []): Collection
53
    {
54
        return $this->dataGroupRepository->getAllWhere($attributes);
55
    }
56
57
    /**
58
     * Create a group with the given attributes
59
     *
60
     * @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...
61
     * @param string|null $email Email of the group
62
     * @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...
63
     */
64 2
    public function create(?string $name = null, ?string $email = null): \BristolSU\ControlDB\Contracts\Models\DataGroup
65
    {
66 2
        $dataGroup = $this->dataGroupRepository->create($name, $email);
67 2
        $this->notify('create', $dataGroup);
68 2
        return $dataGroup;
69
    }
70
71
    /**
72
     * Update a group with the given attributes
73
     *
74
     * @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...
75
     * @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...
76
     * @param string|null $email Email of the group
77
     * @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...
78
     */
79 4
    public function update(int $id, ?string $name = null, ?string $email = null): \BristolSU\ControlDB\Contracts\Models\DataGroup
80
    {
81 4
        $oldDataGroup = $this->getById($id);
82 4
        $newDataGroup = $this->dataGroupRepository->update($id, $name, $email);
83 4
        $this->notify('update', $oldDataGroup, $newDataGroup);
84 4
        return $newDataGroup;
85
    }
86
}