MappedRegistry   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
A find() 0 10 2
1
<?php namespace Cairns\Radiate\Registry;
2
3
final class MappedRegistry implements Registry
4
{
5
    private $listeners = [];
6
7 1
    public function register($event, $listener)
8
    {
9 1
        $this->listeners[$event][] = $listener;
10 1
    }
11
12 2
    public function find($event)
13
    {
14 2
        $eventClassName = get_class($event);
15
16 2
        if (! array_key_exists($eventClassName, $this->listeners)) {
17 1
            return [];
18
        }
19
20 1
        return $this->listeners[$eventClassName];
21
    }
22
}
23