CakeEvmProxy::__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 1
Metric Value
c 1
b 0
f 1
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 Cake\Event\Event as BaseCakeEvent;
5
use Cake\Event\EventManager;
6
7
class CakeEvmProxy implements EventManagerInterface
8
{
9
    /**
10
     * @var EventManager
11
     */
12
    private $eventManager;
13
14
    /**
15
     * Proxy EventManager
16
     */
17 1
    public function __construct()
18
    {
19 1
        $this->eventManager = new EventManager();
20 1
    }
21
22
    /**
23
     * {@inheritDoc}
24
     */
25 1
    public function trigger(EventInterface $event)
26
    {
27 1
        if ($event instanceof BaseCakeEvent) {
28 1
            $this->eventManager->dispatch($event);
29 1
        }
30 1
        return $this;
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36 1
    public function attach($eventName, callable $listener, $priority = 1)
37
    {
38 1
        $options = [];
39 1
        $options['priority'] = $priority;
40 1
        $this->eventManager->on($eventName, $options, $listener);
41 1
        return $this;
42
    }
43
}
44