StandardVoter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 0
dl 0
loc 27
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A supportsCommand() 0 4 1
A vote() 0 6 2
1
<?php
2
3
namespace Innmind\ProvisionerBundle\Voter;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
7
class StandardVoter implements VoterInterface
8
{
9
    protected $triggers;
10
11 54
    public function __construct(array $triggers)
12
    {
13 54
        $this->triggers = $triggers;
14 54
    }
15
16
    /**
17
     * @inheritdoc
18
     */
19 6
    public function supportsCommand($command)
20
    {
21 6
        return in_array($command, $this->triggers, true);
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27 6
    public function vote($command, InputInterface $input)
28
    {
29 6
        return in_array($command, $this->triggers, true) ?
30 6
            self::TRIGGER_GRANTED :
31 6
            self::TRIGGER_ABSTAIN;
32
    }
33
}
34