Consumer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 2

1 Method

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