Completed
Push — master ( 82e59a...afe19b )
by Mike
03:27
created

SimpleQueueVoter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 21
ccs 7
cts 9
cp 0.7778
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getVote() 0 8 2
1
<?php
2
3
namespace MGDigital\BusQue\QueueResolver;
4
5
use MGDigital\BusQue\Exception\QueueResolverException;
6
use MGDigital\BusQue\QueueResolverInterface;
7
8
class SimpleQueueVoter implements QueueVoterInterface
9
{
10
11
    private $resolver;
12
    private $confidence;
13
14 4
    public function __construct(QueueResolverInterface $resolver, int $confidence = QueueVote::CONFIDENCE_NEUTRAL)
15
    {
16 4
        $this->resolver = $resolver;
17 4
        $this->confidence = $confidence;
18 4
    }
19
20 2
    public function getVote($command)
21
    {
22
        try {
23 2
            $queueName = $this->resolver->resolveQueueName($command);
24 2
            return new QueueVote($queueName, $this->confidence);
25
        } catch (QueueResolverException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
26
        }
27
    }
28
}
29