StandardVoter::vote()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4286
cc 2
eloc 4
nc 2
nop 2
crap 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