EventDispatcher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A dispatch() 0 4 2
1
<?php
2
/**
3
 * This file is part of the sauls/object-registry-bundle package.
4
 *
5
 * @author    Saulius Vaičeliūnas <[email protected]>
6
 * @link      http://saulius.vaiceliunas.lt
7
 * @copyright 2018
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Sauls\Bundle\ObjectRegistryBundle\EventDispatcher;
14
15
use Symfony\Component\EventDispatcher\Event;
16
use Symfony\Component\EventDispatcher\EventDispatcherInterface as SymfonyEventDispatcherInterface;
17
18
class EventDispatcher implements EventDispatcherInterface
19
{
20
    /**
21
     * @var SymfonyEventDispatcherInterface
22
     */
23
    private $eventDispatcher;
24
25 1
    public function __construct(SymfonyEventDispatcherInterface $eventDispatcher)
26
    {
27 1
        $this->eventDispatcher = $eventDispatcher;
28 1
    }
29
30 1
    public function dispatch(string $eventName, Event $event): void
31
    {
32 1
        if ($this->eventDispatcher->hasListeners($eventName)) {
33 1
            $this->eventDispatcher->dispatch($eventName, $event);
34
        }
35 1
    }
36
}
37