NativeCommandBus::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Depot\Bus;
4
5
use Depot\Command;
6
use Depot\CommandBus;
7
use Depot\HandlerResolver;
8
9
final class NativeCommandBus implements CommandBus
10
{
11
    /**
12
     * @var HandlerResolver
13
     */
14
    private $resolver;
15
16
    /**
17
     * NativeCommandBus constructor
18
     * @param HandlerResolver $resolver
19
     */
20
    public function __construct(HandlerResolver $resolver)
21
    {
22
        $this->resolver = $resolver;
23
    }
24
25
    /**
26
     * @param Command $command
27
     * @return mixed
28
     */
29
    public function dispatch(Command $command)
30
    {
31
        return $this->resolver->resolve($command)->handle($command);
32
    }
33
}
34