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.

UserGroupNotifier::getUsersThroughGroup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Observers\NotifyObservers\Pivots;
4
5
use BristolSU\ControlDB\Contracts\Models\Group;
6
use BristolSU\ControlDB\Contracts\Models\User;
7
use BristolSU\ControlDB\Contracts\Repositories\Pivots\UserGroup as UserGroupRepository;
8
use BristolSU\ControlDB\Observers\NotifyObservers\Framework\Notifier;
9
use BristolSU\ControlDB\Observers\NotifyObservers\Framework\ObserverStore;
10
use Illuminate\Support\Collection;
11
12
class UserGroupNotifier extends Notifier implements UserGroupRepository
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UserGroupNotifier
Loading history...
13
{
14
15
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
     * @var UserGroupRepository
17
     */
18
    private $userGroupRepository;
0 ignored issues
show
Coding Style introduced by
Private member variable "userGroupRepository" must be prefixed with an underscore
Loading history...
19
20 21
    public function __construct(UserGroupRepository $userGroupRepository, ObserverStore $observerStore)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
21
    {
22 21
        parent::__construct($observerStore, UserGroupRepository::class);
23 21
        $this->userGroupRepository = $userGroupRepository;
24 21
    }
25
26
    /**
27
     * Get all users who are members of a group
28
     *
29
     * @param Group $group
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
30
     * @return User[]|Collection Users who are members of the group
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
31
     */
32 3
    public function getUsersThroughGroup(Group $group): Collection
33
    {
34 3
        return $this->userGroupRepository->getUsersThroughGroup($group);
35
    }
36
37
    /**
38
     * Get all groups a user belongs to
39
     *
40
     * @param User $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
41
     * @return Group[]|Collection Groups the user is a member of
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
42
     */
43 3
    public function getGroupsThroughUser(User $user): Collection
44
    {
45 3
        return $this->userGroupRepository->getGroupsThroughUser($user);
46
    }
47
48
    /**
49
     * Add a user to a group
50
     *
51
     * @param User $user User to add to the group
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 1 found
Loading history...
52
     * @param Group $group Group to add the user to
53
     * @return void
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
54
     */
55 11
    public function addUserToGroup(User $user, Group $group): void
56
    {
57 11
        $this->userGroupRepository->addUserToGroup($user, $group);
58 11
        $this->notify('addUserToGroup', $user, $group);
59 11
    }
60
61
    /**
62
     * Remove a user from a group
63
     * @param User $user User to remove from the group
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 1 found
Loading history...
64
     * @param Group $group Group to remove the user from
65
     * @return void
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
66
     */
67 4
    public function removeUserFromGroup(User $user, Group $group): void
68
    {
69 4
        $this->userGroupRepository->removeUserFromGroup($user, $group);
70 4
        $this->notify('removeUserFromGroup', $user, $group);  
71
    }
72
}