Completed
Push — master ( 54ccda...232c7c )
by Changwan
04:16
created

Configuration   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 53
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A __construct() 0 6 2
A getTimeout() 0 4 1
A getGcFrequency() 0 4 1
A getUniqueId() 0 4 1
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 27
    public function __construct(array $config = [])
19
    {
20 27
        foreach ($config as $key => $value) {
21 1
            $this->{$key} = $value;
22
        }
23 27
    }
24
25
    /**
26
     * @return int
27
     */
28 1
    public function getTimeout()
29
    {
30 1
        return $this->timeout;
31
    }
32
33
    /**
34
     * @return string
35
     */
36 27
    public function getName()
37
    {
38 27
        return $this->name;
39
    }
40
41
    /**
42
     * @return int
43
     */
44 1
    public function getGcFrequency()
45
    {
46 1
        return $this->gc_frequency;
47
    }
48
    
49
    /**
50
     * @return string
51
     */
52 1
    public function getUniqueId()
53
    {
54 1
        return sha1($this->name . uniqid());
55
    }
56
}
57