Completed
Push — master ( d26b40...322ca8 )
by Frank
02:19
created

EventHandlingMessageConsumer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
3
namespace EventSauce\EventSourcing;
4
5
use function end;
6
use function explode;
7
use function get_class;
8
use function method_exists;
9
10
class EventHandlingMessageConsumer implements Consumer
11
{
12 1
    public function handle(Message $message)
13
    {
14 1
        $event = $message->event();
15 1
        $parts = explode('\\', get_class($event));
16 1
        $method = 'handle' . end($parts);
17
18 1
        if (method_exists($this, $method)) {
19 1
            $this->{$method}($event, $message);
20
        }
21 1
    }
22
}
23