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.

DefaultSiteAccessVoter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Netgen\Bundle\SiteAccessRoutesBundle\Matcher\Voter;
6
7
use function in_array;
8
9
final class DefaultSiteAccessVoter implements VoterInterface
10
{
11
    public const DEFAULT_KEY = '_default';
12
13
    /**
14
     * @var string
15
     */
16
    private $defaultSiteAccess;
17
18
    public function __construct(string $defaultSiteAccess)
19
    {
20
        $this->defaultSiteAccess = $defaultSiteAccess;
21
    }
22
23
    /**
24
     * Returns if provided siteaccess is allowed based on passed route config.
25
     */
26
    public function vote(string $siteAccess, array $routeConfig): ?bool
27
    {
28
        if ($siteAccess !== $this->defaultSiteAccess) {
29
            return VoterInterface::ABSTAIN;
30
        }
31
32
        if (in_array(static::DEFAULT_KEY, $routeConfig, true)) {
33
            return true;
34
        }
35
36
        return VoterInterface::ABSTAIN;
37
    }
38
}
39