ResponseBenchmarkFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace San4io\RequestLogger\Logger\ContextFormatters;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\Response;
7
use San4io\RequestLogger\Contracts\ContextFormatterContract;
8
use San4io\RequestLogger\Services\BenchmarkService;
9
10
class ResponseBenchmarkFormatter implements ContextFormatterContract
11
{
12
    /**
13
     * @var BenchmarkService
14
     */
15
    protected $benchmarkService;
16
17
    /**
18
     * BenchmarkFormatter constructor.
19
     * @param BenchmarkService $benchmarkService
20
     */
21
    public function __construct(BenchmarkService $benchmarkService)
22
    {
23
        $this->benchmarkService = $benchmarkService;
24
    }
25
26
    /**
27
     * @param \Illuminate\Http\Request $request
28
     * @param \Illuminate\Http\Response $response
29
     * @return string
30
     */
31
    public function format(Request $request, Response $response)
32
    {
33
        return $this->benchmarkService->result();
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function name(): string
40
    {
41
        return 'response_ms';
42
    }
43
}