Completed
Push — master ( 2dddc8...1df482 )
by Andrii
02:57
created

LoadMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 12
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 2
1
<?php
2
3
namespace hiapi\bus;
4
5
use League\Tactician\Middleware;
6
use Yii;
7
8
class LoadMiddleware implements Middleware
9
{
10
    public function execute($command, callable $next)
11
    {
12
        $error = $command->loadFromRequest(Yii::$app->request);
13
        if ($error) {
14
            throw new \Exception('failed load command, error: ' . var_export($error, true));
15
        }
16
17
        return $next($command);
18
    }
19
}
20