QueueVoterWithWhitelistResolver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getVotes() 0 10 3
1
<?php
2
3
namespace MGDigital\BusQue\QueueResolver;
4
5
class QueueVoterWithWhitelistResolver extends QueueVoterResolver
6
{
7
8
    private $whitelist;
9
10 2
    public function __construct(array $voters, array $whitelist)
11
    {
12 2
        parent::__construct($voters);
13 2
        $this->whitelist = $whitelist;
14 2
    }
15
16 1
    public function getVotes($command): array
17
    {
18 1
        $votes = [ ];
19 1
        foreach (parent::getVotes($command) as $vote) {
20 1
            if (in_array($vote->getQueueName(), $this->whitelist, true)) {
21 1
                $votes[ ] = $vote;
22
            }
23
        }
24 1
        return $votes;
25
    }
26
}
27