Passed
Push — master ( d37ad5...6a9ed7 )
by De Cramer
10:00 queued 07:52
created

ConfigVoter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 11 3
A voteOnAttribute() 0 3 1
1
<?php
2
3
namespace oliverde8\ComfyBundle\Security;
4
5
use oliverde8\ComfyBundle\Model\ConfigInterface;
6
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Securi...on\Token\TokenInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Securi...thorization\Voter\Voter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class ConfigVoter extends Voter
10
{
11
    public const ACTION_VIEW = 'view';
12
    public const ACTION_EDIT = 'edit';
13
14
    protected function supports($attribute, $subject)
15
    {
16
        if ($subject == ConfigInterface::class) {
17
            return true;
18
        }
19
20
        if ($subject instanceof ConfigInterface) {
21
            return true;
22
        }
23
24
        return false;
25
    }
26
27
    protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
28
    {
29
        return true;
30
    }
31
}
32