Completed
Pull Request — master (#66)
by Frank
07:06 queued 04:59
created

EventConsumer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
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
    public function handle(Message $message): void
10
    {
11
        $event = $message->event();
12
        $parts = explode('\\', get_class($event));
13
        $method = 'handle' . end($parts);
14
15
        if (method_exists($this, $method)) {
16
            $this->{$method}($event, $message);
17
        }
18
    }
19
}
20