EventBus   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A dispatch() 0 3 1
1
<?php
2
3
/*
4
 * event-symfony-event-dispatcher (https://github.com/phpgears/event-symfony-event-dispatcher).
5
 * Event bus with Symfony Event Dispatcher.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/event-symfony-event-dispatcher
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\Event\Symfony\Dispatcher;
15
16
use Gears\Event\Event;
17
use Gears\Event\EventBus as EventBusInterface;
18
19
final class EventBus implements EventBusInterface
20
{
21
    /**
22
     * Wrapped event dispatcher.
23
     *
24
     * @var EventDispatcher
25
     */
26
    private $wrappedDispatcher;
27
28
    /**
29
     * EventBus constructor.
30
     *
31
     * @param EventDispatcher $wrappedDispatcher
32
     */
33
    public function __construct(EventDispatcher $wrappedDispatcher)
34
    {
35
        $this->wrappedDispatcher = $wrappedDispatcher;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function dispatch(Event $event): void
42
    {
43
        $this->wrappedDispatcher->dispatch(new EventEnvelope($event));
44
    }
45
}
46