HttpLogger   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 8 2
1
<?php
2
3
namespace Spatie\HttpLogger\Middlewares;
4
5
use Closure;
6
use Illuminate\Http\Request;
7
use Spatie\HttpLogger\LogProfile;
8
use Spatie\HttpLogger\LogWriter;
9
10
class HttpLogger
11
{
12
    protected $logProfile;
13
14
    protected $logWriter;
15
16
    public function __construct(LogProfile $logProfile, LogWriter $logWriter)
17
    {
18
        $this->logProfile = $logProfile;
19
        $this->logWriter = $logWriter;
20
    }
21
22
    public function handle(Request $request, Closure $next)
23
    {
24
        if ($this->logProfile->shouldLogRequest($request)) {
25
            $this->logWriter->logRequest($request);
26
        }
27
28
        return $next($request);
29
    }
30
}
31