QueuePublishMiddleware::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lamoda\TacticianQueue\Middleware;
6
7
use Lamoda\QueueBundle\Factory\PublisherFactory;
8
use League\Tactician\Middleware;
9
10
final class QueuePublishMiddleware implements Middleware
11
{
12
    /** @var PublisherFactory */
13
    private $publisherFactory;
14
15 1
    public function __construct(PublisherFactory $publisherFactory)
16
    {
17 1
        $this->publisherFactory = $publisherFactory;
18 1
    }
19
20 1
    public function execute($command, callable $next)
21
    {
22 1
        $result = $next($command);
23
24 1
        $this->publisherFactory->releaseAll();
25
26 1
        return $result;
27
    }
28
}
29