Passed
Push — master ( a105b5...b5df54 )
by Hector Luis
03:56
created

SingleBus   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 5 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Application Use Case Class
5
 * @author Ticaje <[email protected]>
6
 */
7
8
namespace Ticaje\Hexagonal\Application\UseCase\Bus\Decorator;
9
10
use Ticaje\Hexagonal\Application\Signatures\Responder\ResponseInterface;
11
use Ticaje\Hexagonal\Application\Signatures\UseCase\BusFacadeInterface;
12
use Ticaje\Hexagonal\Application\Signatures\UseCase\ImplementorInterface;
13
use Ticaje\Hexagonal\Application\Signatures\UseCase\UseCaseCommandInterface;
14
15
class SingleBus implements BusFacadeInterface
16
{
17
    /** @var ImplementorInterface */
18
    private $implementor;
19
20
    /**
21
     * Bus constructor.
22
     *
23
     * @param ImplementorInterface $implementor
24
     */
25
    public function __construct(
26
        ImplementorInterface $implementor
27
    ) {
28
        $this->implementor = $implementor;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function execute(UseCaseCommandInterface $command): ResponseInterface
35
    {
36
        $bus = $this->implementor->provide([]);
37
38
        return $bus->handle($command);
39
    }
40
}
41