StandardVoter::supportsCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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