EnvironmentMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 4 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 28
    public function __construct(string $env)
19
    {
20 28
        $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
}