Passed
Push — master ( 08dd0c...2460e1 )
by Koldo
02:21
created

ReleaseEventsMiddleware::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace InFw\TacticianAdapter\CommandBus;
4
5
use InFw\EventSourcing\EmitterInterface;
6
use League\Tactician\Middleware;
7
8
class ReleaseEventsMiddleware implements Middleware
9
{
10
    /**
11
     * @param EmitterInterface $emitter
12
     */
13
    protected $emitter;
14
15
    /**
16
     * @param EmitterInterface $emitter
17
     */
18
    public function __construct(EmitterInterface $emitter)
19
    {
20
        $this->emitter = $emitter;
21
    }
22
23
    /**
24
     * @param object $command
25
     * @param callable $next
26
     *
27
     * @return mixed
28
     */
29
    public function execute($command, callable $next)
30
    {
31
        $returnValue = $next($command);
32
33
        $this->emitter->publish();
34
35
        return $returnValue;
36
    }
37
}
38