DumpLogMiddleware   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 3
A __construct() 0 3 1
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
use Symfony\Component\VarDumper\VarDumper;
17
18
/**
19
 * @author Ishmael Doss <[email protected]>
20
 */
21
class DumpLogMiddleware implements Middleware
22
{
23
    private $isDebug;
24
25
    public function __construct($isDebug)
26
    {
27
        $this->isDebug = $isDebug;
28
    }
29
30
    /**
31
     * @param AbstractCommand $command
32
     *
33
     * {@inheritdoc}
34
     */
35
    public function execute($command, callable $next)
36
    {
37
        // dev only
38
        if ($this->isDebug && $command->logs) {
39
            VarDumper::dump($command->logs);
40
        }
41
42
        return $next($command);
43
    }
44
}
45