EventDispatcherHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 2
c 0
b 0
f 0
dl 0
loc 12
rs 10
ccs 1
cts 1
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A dispatch() 0 2 2
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\EventDispatcher;
13
14
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
15
use Symfony\Contracts\EventDispatcher\Event;
16
17
/**
18
 * Event dispatcher helper.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Bundle\CoreBundle\EventDispatcher
22
 */
23
class EventDispatcherHelper {
24
25
    /**
26
     * Dispatch an event.
27
     *
28
     * @param EventDispatcherInterface|null $eventDispatcher The event dispatcher.
29
     * @param Event $event The event.
30
     * @param string|null $eventName The event name.
31
     * @return Event Returns the event.
32
     */
33
    public static function dispatch(?EventDispatcherInterface $eventDispatcher, Event $event, string $eventName = null): Event {
34 50
        return null === $eventDispatcher ? $event : $eventDispatcher->dispatch($event, $eventName);
35
    }
36
}
37