Completed
Push — master ( 1cd9a0...4f8c6b )
by Dmitry
04:09
created

Event::subscribe()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Basis;
4
5
class Event
6
{
7
    private $dispatcher;
8
9
    public function __construct(Dispatcher $dispatcher)
10
    {
11
        $this->dispatcher = $dispatcher;
12
    }
13
14
    public function fire($event, $context)
15
    {
16
        $this->dispatcher->dispatch('event.fire', [
17
            'event' => $event,
18
            'context' => $context
19
        ]);
20
    }
21
22
    public function subscribe($event, $listener)
23
    {
24
        $this->dispatcher->dispatch('event.subscribe', [
25
            'event' => $event,
26
            'listener' => $listener,
27
        ]);
28
    }
29
}
30