ZendEvmProxy::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Penny\Event;
3
4
use Zend\EventManager\EventInterface as ZendEventInterface;
5
use Zend\EventManager\EventManager;
6
7
class ZendEvmProxy implements EventManagerInterface
8
{
9
    /**
10
     * @var EventManager
11
     */
12
    private $eventManager;
13
14
    /**
15
     * Proxy Zend\EventManager\EventManager
16
     */
17 19
    public function __construct()
18
    {
19 19
        $this->eventManager = new EventManager();
20 19
    }
21
22
    /**
23
     * {@inheritDoc}
24
     */
25 14
    public function trigger(EventInterface $event)
26
    {
27 14
        if ($event instanceof ZendEventInterface) {
28 14
            $this->eventManager->trigger($event);
29 14
        }
30
31 14
        return $this;
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     */
37 19
    public function attach($eventName, callable $listener, $priority = 0)
38
    {
39 19
        $this->eventManager->attach($eventName, $listener, $priority);
40 19
        return $this;
41
    }
42
}
43