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

SingleBus::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
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