Session   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getMinutes() 0 4 1
A getValue() 0 10 2
1
<?php
2
3
namespace PragmaRX\Tracker\Vendor\Laravel\Support;
4
5
use Illuminate\Support\Facades\Request;
6
use PragmaRX\Tracker\Support\Minutes;
7
use Session as LaravelSession;
8
9
class Session
10
{
11
    private $minutes;
12
13
    public function __construct()
14
    {
15
        LaravelSession::put('tracker.stats.days', $this->getValue('days', 1));
16
17
        LaravelSession::put('tracker.stats.page', $this->getValue('page', 'visits'));
18
19
        $this->minutes = new Minutes(60 * 24 * LaravelSession::get('tracker.stats.days'));
20
    }
21
22
    /**
23
     * @return Minutes
24
     */
25
    public function getMinutes()
26
    {
27
        return $this->minutes;
28
    }
29
30
    public function getValue($variable, $default = null)
31
    {
32
        if (Request::has($variable)) {
33
            $value = Request::get($variable);
34
        } else {
35
            $value = LaravelSession::get('tracker.stats.'.$variable, $default);
36
        }
37
38
        return $value;
39
    }
40
}
41