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

Event   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 25
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fire() 0 7 1
A subscribe() 0 7 1
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