Passed
Push — main ( 987cb0...4f2490 )
by De Cramer
02:59
created

EtlExecutionVoter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 22
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\PhpEtlBundle\Security;
4
5
use Oliverde8\PhpEtlBundle\Entity\EtlExecution;
6
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
7
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
8
9
class EtlExecutionVoter extends Voter
10
{
11
    const QUEUE = 'queue';
12
    const VIEW = 'view';
13
    const DOWNLOAD = 'download';
14
15
    protected function supports($attribute, $subject)
16
    {
17
        if ($subject == EtlExecution::class) {
18
            return true;
19
        }
20
21
        if ($subject instanceof EtlExecution) {
22
            return true;
23
        }
24
25
        return false;
26
    }
27
28
    protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
29
    {
30
        return true;
31
    }
32
}
33