ZendEvmProxy::trigger()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 2
rs 9.4285
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