Passed
Push — master ( ed3a21...c78a04 )
by Guido
06:24
created

GvEventListenerRegistry   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A registerEventListeners() 0 10 1
1
<?php
2
3
namespace Gvera\Helpers\bootstrap;
4
5
use Gvera\Events\ThrowableFiredEvent;
6
use Gvera\Events\UserRegisteredEvent;
7
use Gvera\Helpers\dependencyInjection\DIContainer;
8
use Gvera\Helpers\events\EventListenerRegistry;
9
use ReflectionException;
10
11
class GvEventListenerRegistry extends EventListenerRegistry
12
{
13
    /**
14
     * @var DIContainer
15
     */
16
    private DIContainer $container;
17
18
    public function __construct(DIContainer $container)
19
    {
20
        $this->container = $container;
21
    }
22
23
    /**
24
     * @throws ReflectionException
25
     */
26
    public function registerEventListeners()
27
    {
28
        $this->registerEventListener(
29
            ThrowableFiredEvent::THROWABLE_FIRED_EVENT,
30
            $this->container->get('throwableListener')
31
        );
32
33
        $this->registerEventListener(
34
            UserRegisteredEvent::USER_REGISTERED_EVENT,
35
            $this->container->get('userRegisteredEmailListener')
36
        );
37
    }
38
}
39