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.

Issues (472)

app/Rules/UserBelongsToGroup.php (21 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\AssignRoles\Rules;
4
5
use BristolSU\ControlDB\Contracts\Models\Group;
6
use BristolSU\ControlDB\Contracts\Models\User;
7
use BristolSU\ControlDB\Contracts\Repositories\User as UserRepository;
8
use BristolSU\Support\Authentication\Contracts\Authentication;
9
use Illuminate\Contracts\Validation\Rule;
10
11
/**
12
 * Is the user a member of the group
13
 * 
14
 * @package BristolSU\Module\AssignRoles\Rules
15
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @author tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
16
class UserBelongsToGroup implements Rule
17
{
18
19
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
20
     * @var Authentication
21
     */
22
    private $authentication;
0 ignored issues
show
Private member variable "authentication" must be prefixed with an underscore
Loading history...
23
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
24
     * @var UserRepository
25
     */
26
    private $userRepository;
0 ignored issues
show
Private member variable "userRepository" must be prefixed with an underscore
Loading history...
27
28 7
    public function __construct(Authentication $authentication, UserRepository $userRepository)
0 ignored issues
show
Missing doc comment for function __construct()
Loading history...
29
    {
30 7
        $this->authentication = $authentication;
31 7
        $this->userRepository = $userRepository;
32 7
    }
33
34
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $attribute should have a doc-comment as per coding-style.
Loading history...
Parameter $value should have a doc-comment as per coding-style.
Loading history...
35
     * @inheritDoc
36
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
37 7
    public function passes($attribute, $value)
38
    {
39 7
        $user = app(UserRepository::class)->getById((int) $value);
0 ignored issues
show
The assignment to $user is dead and can be removed.
Loading history...
40 7
        $groupToMatch = $this->group();
41
        return $this->userRepository->getById($value)->groups()->filter(function(Group $group) use ($groupToMatch) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
42 6
            return $group->id() === $groupToMatch->id();
43 7
        })->count() > 0;
0 ignored issues
show
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...
44
    }
45
    
46 7
    protected function group() 
0 ignored issues
show
Missing doc comment for function group()
Loading history...
47
    {
48 7
        return $this->authentication->getGroup();
49
    }
50
51
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
52
     * @inheritDoc
53
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
54 1
    public function message()
55
    {
56 1
        return 'The user is not a member of the group';
57
    }
58
}