Passed
Push — main ( 3aa672...0dc4a1 )
by Proyecto
08:04
created

CommandRunner   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 14
ccs 4
cts 7
cp 0.5714
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A execute() 0 5 1
1
<?php
2
3
namespace ProyectoTAU\TAU\Common;
4
5
use League\Tactician\Middleware;
6
7
class CommandRunner implements Middleware
8
{
9
    private $handler;
10
11
    public function __construct($handler = 'Handler')
12
    {
13
        $this->handler = $handler;
14
    }
15
16 31
    public function execute(object $command, callable $next)
17
    {
18 31
        $commandName = \get_class($command);
19 31
        $commandHandler = $commandName.$this->handler;
20 31
        app()->get($commandHandler)->handle($command);
21 31
    }
22
}
23