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 ( 0c5c4d...5cc6ab )
by Toby
29:02 queued 14s
created

DataUserNotifier   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 83
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 83
ccs 15
cts 19
cp 0.7895
rs 10

6 Methods

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