NativeCommandBus   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A dispatch() 0 4 1
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