GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CommandHandlerMiddleWare::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace SmoothPhp\CommandBus;
3
4
use SmoothPhp\Contracts\CommandBus\Command;
5
use SmoothPhp\Contracts\CommandBus\CommandBusMiddleware;
6
use SmoothPhp\Contracts\CommandBus\CommandHandlerResolver;
7
use SmoothPhp\Contracts\CommandBus\CommandTranslator;
8
9
/**
10
 * Class PlainCommandBus
11
 * @package SmoothPhp\CommandBus
12
 * @author Simon Bennett <[email protected]>
13
 */
14
final class CommandHandlerMiddleWare implements CommandBusMiddleware
15
{
16
    /** @var CommandTranslator */
17
    private $commandTranslator;
18
19
    /** @var CommandHandlerResolver */
20
    private $handlerResolver;
21
22
    /**
23
     * @param CommandTranslator $commandTranslator
24
     * @param CommandHandlerResolver $handlerResolver
25
     */
26 9
    public function __construct(CommandTranslator $commandTranslator, CommandHandlerResolver $handlerResolver)
27
    {
28 9
        $this->commandTranslator = $commandTranslator;
29 9
        $this->handlerResolver = $handlerResolver;
30 9
    }
31
32
    /**
33
     * @param Command $command
34
     * @param callable $next
35
     * @return mixed|void
36
     */
37 9
    public function execute(Command $command, callable $next)
38
    {
39 9
        $handler = $this->commandTranslator->toCommandHandler($command);
40
41 6
        return $this->handlerResolver->make($handler)->handle($command);
42
    }
43
}