Completed
Pull Request — master (#153)
by Abdul Malik
04:49
created

FastEvmProxy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A trigger() 0 5 1
A attach() 0 5 1
1
<?php
2
namespace Penny\Event;
3
4
use FastEventManager\EventManager;
5
6
class FastEvmProxy implements EventManagerInterface
7
{
8
    /**
9
     * @var EventManager
10
     */
11
    private $eventManager;
12
13
    /**
14
     * Proxy EventManager
15
     */
16
    public function __construct()
17
    {
18
        $this->eventManager = new EventManager();
19
    }
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function trigger(EventInterface $event)
25
    {
26
        $this->eventManager->trigger($event->getName());
27
        return $this;
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    public function attach($eventName, callable $listener, $priority = 0)
34
    {
35
        $this->eventManager->attach($eventName, $listener, $priority);
36
        return $this;
37
    }
38
}
39