Test Failed
Push — master ( 99edcd...37bac2 )
by
04:31 queued 02:01
created

DummyStoragePersistMiddleware::execute()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 4
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the LineMob package.
5
 *
6
 * (c) Ishmael Doss <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LineMob\Core\Middleware;
13
14
use League\Tactician\Middleware;
15
use LineMob\Core\Command\AbstractCommand;
16
17
/**
18
 * @author Ishmael Doss <[email protected]>
19
 */
20
class DummyStoragePersistMiddleware implements Middleware
21
{
22
    /**
23
     * @param AbstractCommand $command
24
     *
25
     * {@inheritdoc}
26
     */
27
    public function execute($command, callable $next)
28
    {
29
        if (!$command->storage) {
30
            throw new \RuntimeException("Require storage before using this middleware!");
31
        }
32
33
        $command->storage->setLineCommandData($command->getData());
34
35
        return $next($command);
36
    }
37
}
38