Passed
Push — master ( 27c83c...3b806d )
by Loban
03:03
created

EnvironmentMiddleware::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * @link https://github.com/lav45/yii2-activity-logger
4
 * @copyright Copyright (c) 2017 LAV45
5
 * @author Alexey Loban <[email protected]>
6
 * @license http://opensource.org/licenses/BSD-3-Clause
7
 */
8
9
namespace lav45\activityLogger\middlewares;
10
11
use Closure;
12
use lav45\activityLogger\MessageBuilderInterface;
13
14
final class EnvironmentMiddleware implements Middleware
15
{
16
    private string $env;
17
18 31
    public function __construct(string $env)
19
    {
20 31
        $this->env = $env;
21
    }
22
23 28
    public function handle(MessageBuilderInterface $builder, Closure $next): MessageBuilderInterface
24
    {
25 28
        $builder = $builder->withEnv($this->env);
26 28
        return $next($builder);
27
    }
28
}