Completed
Push — master ( a4f973...4e0df9 )
by Nicolas
9s
created

CommandBus::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace BSP;
5
6
abstract class CommandBus
7
{
8
    /** @var CommandHandler[] */
9
    protected $handlers = [];
10
11 1
    public function execute(Command $command): void
12
    {
13 1
        if (isset($this->handlers[get_class($command)])) {
14 1
            $this->handlers[get_class($command)]->handle($command);
15
        }
16 1
    }
17
}
18