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
Pull Request — master (#14)
by Toby
31:11 queued 12:50
created

DataRoleTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 36
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setRoleName() 0 3 1
A setEmail() 0 3 1
A role() 0 6 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
namespace BristolSU\ControlDB\Traits;
5
6
7
use BristolSU\ControlDB\Contracts\Models\Role;
8
use BristolSU\ControlDB\Contracts\Repositories\DataRole;
9
use Illuminate\Database\Eloquent\ModelNotFoundException;
10
11
/**
12
 * Implements methods to the data role interface using repositories
13
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
14
trait DataRoleTrait
15
{
16
17
    /**
18
     * Get the role using the data role
19
     *
20
     * @return Role|null
21
     */
22 2
    public function role(): ?Role
23
    {
24
        try {
25 2
            return app(\BristolSU\ControlDB\Contracts\Repositories\Role::class)->getByDataProviderId($this->id());
0 ignored issues
show
Bug introduced by
It seems like id() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
            return app(\BristolSU\ControlDB\Contracts\Repositories\Role::class)->getByDataProviderId($this->/** @scrutinizer ignore-call */ id());
Loading history...
26 1
        } catch (ModelNotFoundException $e) {
27 1
            return null;
28
        }
29
    }
30
31
    /**
32
     * Set the email of the role
33
     *
34
     * @param string|null $email
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
35
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
36 4
    public function setEmail(?string $email): void
37
    {
38 4
        app(DataRole::class)->update($this->id(), $this->roleName(), $email);
0 ignored issues
show
Bug introduced by
It seems like roleName() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        app(DataRole::class)->update($this->id(), $this->/** @scrutinizer ignore-call */ roleName(), $email);
Loading history...
39 4
    }
40
41
42
    /**
43
     * Set a name for the role
44
     *
45
     * @param string|null $roleName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
46
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
47 4
    public function setRoleName(?string $roleName): void
48
    {
49 4
        app(DataRole::class)->update($this->id(), $roleName, $this->email());
0 ignored issues
show
Bug introduced by
It seems like email() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        app(DataRole::class)->update($this->id(), $roleName, $this->/** @scrutinizer ignore-call */ email());
Loading history...
50
51
    }
52
}