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

LoadMiddleware::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 1
cp 0
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 6
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