Completed
Push — master ( a40fc9...4580d0 )
by ARCANEDEV
03:02
created

SettingsMiddleware   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 44
rs 10
c 1
b 0
f 0
ccs 0
cts 12
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
A terminate() 0 4 1
1
<?php namespace Arcanedev\Settings\Http\Middleware;
2
3
use Arcanedev\Settings\Contracts\Store as Settings;
4
use Closure;
5
use Illuminate\Http\Request;
6
use Symfony\Component\HttpFoundation\Response;
7
8
/**
9
 * Class     SettingsMiddleware
10
 *
11
 * @package  Arcanedev\Settings\Http\Middleware
12
 * @author   ARCANEDEV <[email protected]>
13
 */
14
class SettingsMiddleware
15
{
16
    /* ------------------------------------------------------------------------------------------------
17
     |  Constructor
18
     | ------------------------------------------------------------------------------------------------
19
     */
20
    /**
21
     * Create a new save settings middleware
22
     *
23
     * @param  \Arcanedev\Settings\Contracts\Store  $settings
24
     */
25
    public function __construct(Settings $settings)
26
    {
27
        $this->settings = $settings;
0 ignored issues
show
Bug introduced by
The property settings does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
    }
29
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Main Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Handle an incoming request.
36
     *
37
     * @param  \Illuminate\Http\Request  $request
38
     * @param  \Closure                  $next
39
     *
40
     * @return mixed
41
     */
42
    public function handle(Request $request, Closure $next)
43
    {
44
        return $next($request);
45
    }
46
47
    /**
48
     * Perform any final actions for the request lifecycle.
49
     *
50
     * @param  \Illuminate\Http\Request                    $request
51
     * @param  \Symfony\Component\HttpFoundation\Response  $response
52
     */
53
    public function terminate(Request $request, Response $response)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from 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.

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

Loading history...
54
    {
55
        $this->settings->save();
56
    }
57
}
58