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/PositionIsAllowed.php (15 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\AssignRoles\Rules;
4
5
use BristolSU\Module\AssignRoles\Support\PositionSettingRetrieval;
6
use BristolSU\Support\Authentication\Contracts\Authentication;
7
use Illuminate\Contracts\Validation\Rule;
8
9
class PositionIsAllowed implements Rule
0 ignored issues
show
Missing doc comment for class PositionIsAllowed
Loading history...
10
{
11
12
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
13
     * @var PositionSettingRetrieval
14
     */
15
    private $positionSettingRetrieval;
0 ignored issues
show
Private member variable "positionSettingRetrieval" must be prefixed with an underscore
Loading history...
16
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
17
     * @var Authentication
18
     */
19
    private $authentication;
0 ignored issues
show
Private member variable "authentication" must be prefixed with an underscore
Loading history...
20
21 11
    public function __construct(PositionSettingRetrieval $positionSettingRetrieval, Authentication $authentication)
0 ignored issues
show
Missing doc comment for function __construct()
Loading history...
22
    {
23 11
        $this->positionSettingRetrieval = $positionSettingRetrieval;
24 11
        $this->authentication = $authentication;
25 11
    }
26
27
    /**
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...
28
     * @inheritDoc
29
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
30 10
    public function passes($attribute, $value)
31
    {
32
        try {
33 10
            $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

33
            $settings = $this->positionSettingRetrieval->getSettings(/** @scrutinizer ignore-type */ $this->group());
Loading history...
34
        } catch (\Exception $e) {
35
            return false;
36
        }
37
        
38 10
        return in_array($value, $settings['allowed']);
39
    }
40
41 10
    protected function group()
0 ignored issues
show
Missing doc comment for function group()
Loading history...
42
    {
43 10
        return $this->authentication->getGroup();
44
    }
45
46
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
47
     * @inheritDoc
48
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
49 1
    public function message()
50
    {
51 1
        return 'The position is not available to use';
52
    }
53
}