@@ -14,18 +14,18 @@ |
||
14 | 14 | private $queueName; |
15 | 15 | private $confidence; |
16 | 16 | |
17 | - public function __construct(string $queueName, int $confidence) |
|
17 | + public function __construct (string $queueName, int $confidence) |
|
18 | 18 | { |
19 | 19 | $this->queueName = $queueName; |
20 | 20 | $this->confidence = $confidence; |
21 | 21 | } |
22 | 22 | |
23 | - public function getQueueName(): string |
|
23 | + public function getQueueName (): string |
|
24 | 24 | { |
25 | 25 | return $this->queueName; |
26 | 26 | } |
27 | 27 | |
28 | - public function getConfidence(): int |
|
28 | + public function getConfidence (): int |
|
29 | 29 | { |
30 | 30 | return $this->confidence; |
31 | 31 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | private $resolver; |
12 | 12 | private $confidence; |
13 | 13 | |
14 | - public function __construct(QueueResolverInterface $resolver, int $confidence = QueueVote::CONFIDENCE_NEUTRAL) |
|
14 | + public function __construct (QueueResolverInterface $resolver, int $confidence = QueueVote::CONFIDENCE_NEUTRAL) |
|
15 | 15 | { |
16 | 16 | $this->resolver = $resolver; |
17 | 17 | $this->confidence = $confidence; |
18 | 18 | } |
19 | 19 | |
20 | - public function getVote($command) |
|
20 | + public function getVote ($command) |
|
21 | 21 | { |
22 | 22 | try { |
23 | 23 | $queueName = $this->resolver->resolveQueueName($command); |
@@ -11,38 +11,38 @@ |
||
11 | 11 | /** |
12 | 12 | * @var QueueVoterInterface[] |
13 | 13 | */ |
14 | - private $voters = []; |
|
14 | + private $voters = [ ]; |
|
15 | 15 | |
16 | - public function __construct(array $voters) |
|
16 | + public function __construct (array $voters) |
|
17 | 17 | { |
18 | - array_walk($voters, function (QueueVoterInterface $voter) { |
|
19 | - $this->voters[] = $voter; |
|
18 | + array_walk($voters, function(QueueVoterInterface $voter) { |
|
19 | + $this->voters[ ] = $voter; |
|
20 | 20 | }); |
21 | 21 | } |
22 | 22 | |
23 | - public function resolveQueueName($command): string |
|
23 | + public function resolveQueueName ($command): string |
|
24 | 24 | { |
25 | 25 | $votes = $this->getVotes($command); |
26 | - if ($votes === []) { |
|
26 | + if ($votes === [ ]) { |
|
27 | 27 | throw new QueueResolverException; |
28 | 28 | } |
29 | - return $votes[0]->getQueueName(); |
|
29 | + return $votes[ 0 ]->getQueueName(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @param mixed $command |
34 | 34 | * @return QueueVote[] |
35 | 35 | */ |
36 | - public function getVotes($command): array |
|
36 | + public function getVotes ($command): array |
|
37 | 37 | { |
38 | - $votes = []; |
|
38 | + $votes = [ ]; |
|
39 | 39 | foreach ($this->voters as $voter) { |
40 | 40 | $vote = $voter->getVote($command); |
41 | 41 | if ($vote instanceof QueueVote) { |
42 | - $votes[] = $vote; |
|
42 | + $votes[ ] = $vote; |
|
43 | 43 | } |
44 | 44 | } |
45 | - usort($votes, function (QueueVote $voteA, QueueVote $voteB) { |
|
45 | + usort($votes, function(QueueVote $voteA, QueueVote $voteB) { |
|
46 | 46 | return $voteB->getConfidence() <=> $voteA->getConfidence(); |
47 | 47 | }); |
48 | 48 | return $votes; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | class ClassNameQueueResolver implements QueueResolverInterface |
9 | 9 | { |
10 | 10 | |
11 | - public function resolveQueueName($command): string |
|
11 | + public function resolveQueueName ($command): string |
|
12 | 12 | { |
13 | 13 | if (!is_object($command)) { |
14 | 14 | throw new QueueResolverException('The command cannot be converted to a class name queue.'); |