Passed
Push — master ( 4e3abd...c23c95 )
by Jesse
02:09
created

CommandHandlerAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\Infrastructure;
4
5
use function assert;
6
use Stratadox\CardGame\Command;
7
use Stratadox\CardGame\CommandHandler;
8
use Stratadox\CommandHandling\Handler;
9
10
final class CommandHandlerAdapter implements Handler
11
{
12
    /** @var CommandHandler */
13
    private $handler;
14
15
    public function __construct(CommandHandler $handler)
16
    {
17
        $this->handler = $handler;
18
    }
19
20
    public function handle(object $command): void
21
    {
22
        assert($command instanceof Command);
23
        $this->handler->handle($command);
24
    }
25
}
26