Passed
Push — master ( cbefbc...3619f4 )
by Frank
16:49 queued 06:49
created

DecoratingMessageDispatcher::dispatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing;
6
7
class DecoratingMessageDispatcher implements MessageDispatcher
8
{
9
    public function __construct(private MessageDispatcher $dispatcher, private MessageDecorator $decorator)
10
    {
11
    }
12
13
    public function dispatch(Message ...$messages): void
14
    {
15
        $this->dispatcher->dispatch(
16
            ...array_map(fn (Message $message) => $this->decorator->decorate($message), $messages)
17
        );
18
    }
19
}
20