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/RoleHasSpaceToAssign.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\Repositories\Role;
6
use BristolSU\Module\AssignRoles\Support\PositionSettingRetrieval;
7
use BristolSU\Support\Authentication\Contracts\Authentication;
8
use Illuminate\Contracts\Validation\Rule;
9
10
/**
11
 * Does the role given have space to assign?
12
 * 
13
 * This is not the case if the role should only have a single user, and it already has a user
14
 * 
15
 * @package BristolSU\Module\AssignRoles\Rules
16
 */
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...
17
class RoleHasSpaceToAssign implements Rule
18
{
19
20
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
21
     * @var PositionSettingRetrieval
22
     */
23
    private $positionSettingRetrieval;
0 ignored issues
show
Private member variable "positionSettingRetrieval" must be prefixed with an underscore
Loading history...
24
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
25
     * @var Authentication
26
     */
27
    private $authentication;
0 ignored issues
show
Private member variable "authentication" must be prefixed with an underscore
Loading history...
28
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
29
     * @var Role
30
     */
31
    private $roleRepository;
0 ignored issues
show
Private member variable "roleRepository" must be prefixed with an underscore
Loading history...
32
33 7
    public function __construct(Authentication $authentication, PositionSettingRetrieval $positionSettingRetrieval, Role $roleRepository)
0 ignored issues
show
Missing doc comment for function __construct()
Loading history...
34
    {
35 7
        $this->positionSettingRetrieval = $positionSettingRetrieval;
36 7
        $this->authentication = $authentication;
37 7
        $this->roleRepository = $roleRepository;
38 7
    }
39
40
    /**
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...
41
     * @inheritDoc
42
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
43 7
    public function passes($attribute, $value)
44
    {
45
        try {
46 7
            $settings = $this->positionSettingRetrieval->getSettings($this->group());
0 ignored issues
show
It seems like $this->group() can also be of type null; however, parameter $group of BristolSU\Module\AssignR...etrieval::getSettings() does only seem to accept BristolSU\ControlDB\Contracts\Models\Group, maybe add an additional type check? ( Ignorable by Annotation )

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

46
            $settings = $this->positionSettingRetrieval->getSettings(/** @scrutinizer ignore-type */ $this->group());
Loading history...
47
        } catch (\Exception $e) {
48
            return false;
49
        }
50 7
        if(in_array($value, $settings['only_one_user'])) {
0 ignored issues
show
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
51 2
            return $this->roleRepository->getById($value)->users()->count() === 0;
52
        }
53 5
        return true;
54
    }
55
56 7
    protected function group()
0 ignored issues
show
Missing doc comment for function group()
Loading history...
57
    {
58 7
        return $this->authentication->getGroup();
59
    }
60
61
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
62
     * @inheritDoc
63
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
64 1
    public function message()
65
    {
66 1
        return 'A user is already assigned to this role';
67
    }
68
}