AsyncEventExecutor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
namespace Workana\AsyncJobs\Executor;
3
4
use Workana\AsyncJobs\AsyncEvent;
5
use Interop\Container\ContainerInterface;
6
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
7
8
/**
9
 * Executes an async event
10
 *
11
 * @author Carlos Frutos <[email protected]>
12
 */
13
class AsyncEventExecutor
14
{
15
    /**
16
     * @var EventDispatcherInterface
17
     */
18
    protected $eventDispatcher;
19
20
    /**
21
     * @var EventDispatcherInterface $eventDispatcher
22
     */
23
    public function __construct(EventDispatcherInterface $eventDispatcher)
24
    {
25
        $this->eventDispatcher = $eventDispatcher;
26
    }
27
28
    /**
29
     * Invokes the executor
30
     *
31
     * @var AsyncEvent $asyncEvent
32
     *
33
     * @return void
34
     */
35
    public function __invoke(AsyncEvent $asyncEvent)
36
    {
37
        $this->eventDispatcher->dispatch($asyncEvent->getEventName(), $asyncEvent->getEvent());
38
    }
39
}