Completed
Push — master ( 495169...b31514 )
by Changwan
10:11
created

Configuration::getGcFrequency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Wandu\Http\Session;
3
4
class Configuration
5
{
6
    /** @var int */
7
    protected $timeout = 3600;
8
    
9
    /** @var string */
10
    protected $name = 'WdSessId';
11
12
    /** @var int */
13
    protected $gc_frequency = 100;
14
    
15
    /**
16
     * @param array $config
17
     */
18 26
    public function __construct(array $config = [])
19
    {
20 26
        foreach ($config as $key => $value) {
21
            $this->{$key} = $value;
22
        }
23 26
    }
24
25
    /**
26
     * @return int
27
     */
28
    public function getTimeout()
29
    {
30
        return $this->timeout;
31
    }
32
33
    /**
34
     * @return string
35
     */
36 26
    public function getName()
37
    {
38 26
        return $this->name;
39
    }
40
41
    /**
42
     * @return int
43
     */
44
    public function getGcFrequency()
45
    {
46
        return $this->gc_frequency;
47
    }
48
    
49
    /**
50
     * @return string
51
     */
52
    public function getUniqueId()
53
    {
54
        return sha1($this->name . uniqid());
55
    }
56
}
57