Passed
Push — master ( dbfb37...74a6ed )
by Frank
46s queued 13s
created

EventConsumer   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 6
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
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing;
6
7
abstract class EventConsumer implements Consumer
8
{
9 1
    public function handle(Message $message): void
10
    {
11 1
        $event = $message->event();
12 1
        $parts = explode('\\', get_class($event));
13 1
        $method = 'handle' . end($parts);
14
15 1
        if (method_exists($this, $method)) {
16 1
            $this->{$method}($event, $message);
17
        }
18 1
    }
19
}
20