ConfigEditVoter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
c 1
b 1
f 0
dl 0
loc 20
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A voteOnAttribute() 0 3 1
A supports() 0 3 2
1
<?php
2
3
namespace oliverde8\ComfyEasyAdminBundle\Security\Voter;
4
5
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
6
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
7
8
class ConfigEditVoter extends Voter
9
{
10
    const ACTION_NEW = 'edit';
11
12
    const ACTIONS = [self::ACTION_NEW];
13
14
    /**
15
     * @inheritDoc
16
     */
17
    protected function supports($attribute, $subject)
18
    {
19
        return in_array($attribute, self::ACTIONS) && $subject instanceof \oliverde8\ComfyBundle\Model\ConfigInterface;
20
    }
21
22
    /**
23
     * @inheritDoc
24
     */
25
    protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
26
    {
27
        return true;
28
    }
29
}
30