Completed
Push — master ( 2ebd86...f3e1bf )
by recca
03:14 queued 01:25
created

SwapConfig   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 43
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 7 1
1
<?php
2
3
namespace Recca0120\Config\Middleware;
4
5
use Recca0120\Config\Contracts\Repository;
6
use Illuminate\Contracts\Foundation\Application;
7
8
class SwapConfig
9
{
10
    /**
11
     * $app.
12
     *
13
     * @var \Illuminate\Contracts\Foundation\Application
14
     */
15
    protected $app;
16
17
    /**
18
     * $config.
19
     *
20
     * @var \Recca0120\Config\Contracts\Repository
21
     */
22
    protected $config;
23
24
    /**
25
     * __construct.
26
     *
27
     * @param \Illuminate\Contracts\Foundation\Application $app
28
     * @param \Recca0120\Config\Contracts\Repository $config
29
     */
30 1
    public function __construct(Application $app, Repository $config)
31
    {
32 1
        $this->app = $app;
33 1
        $this->config = $config;
34 1
    }
35
36
    /**
37
     * handle.
38
     *
39
     * @param \Illuminate\Http\Request $request
40
     * @param \Closure $next
41
     * @return \Symfony\Component\HttpFoundation\Response
42
     */
43 1
    public function handle($request, $next)
44
    {
45 1
        $this->app->instance('config', $this->config);
46 1
        date_default_timezone_set($this->config->get('app.timezone'));
47
48 1
        return $next($request);
49
    }
50
}
51