EventHandlingMessageConsumer   A
last analyzed

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