Completed
Push — master ( ac5b6c...2ebd86 )
by recca
02:43
created

SwapConfigRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 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 SwapConfigRepository
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