TerminateMiddleware::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 11
rs 10
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Bavix\Prof\Middleware;
4
5
use Bavix\Prof\Services\ProfileLogService;
6
use Illuminate\Http\Request;
7
use Closure;
8
9
class TerminateMiddleware
10
{
11
12
    /**
13
     * @param Request $request
14
     * @param Closure $next
15
     * @return mixed
16
     */
17
    public function handle(Request $request, Closure $next)
18
    {
19
        /**
20
         * Note from the beginning of the application...
21
         */
22
        if (\config('prof.globalMiddleware', false)) {
23
            app(ProfileLogService::class)
24
                ->tick('app:init');
25
        }
26
27
        return $next($request);
28
    }
29
30
    /**
31
     * @param $request
32
     * @param $response
33
     */
34
    public function terminate($request, $response): void
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function terminate(/** @scrutinizer ignore-unused */ $request, $response): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $response is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function terminate($request, /** @scrutinizer ignore-unused */ $response): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
        /**
37
         * If there are started ticks, but not completed, we complete it.
38
         */
39
        app(ProfileLogService::class)
40
            ->recordAllTicks();
41
    }
42
43
}
44