EventBus::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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