Server   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
1
<?php
2
3
/**
4
 * This file is part of slick/session package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Session\Driver;
11
12
use Slick\Session\SessionDriverInterface;
13
14
/**
15
 * Session Server driver (Default php session handling)
16
 *
17
 * @package Slick\Session\Driver
18
 * @author  Filipe Silva <[email protected]>
19
 */
20
class Server extends Driver implements SessionDriverInterface
21
{
22
23
    /**
24
     * @var string Session cookie name
25
     */
26
    protected $name = 'SLICKSID';
27
28
    /**
29
     * @var string Session cookie domain
30
     */
31
    protected $domain = null;
32
33
    /**
34
     * @var integer Session cookie lifetime
35
     */
36
    protected $lifetime = 0;
37
38
    /**
39
     * Overrides base constructor to set parameters and initialize session.
40
     *
41
     * @param array $options
42
     */
43 6
    public function __construct(array $options = [])
44
    {
45 6
        parent::__construct($options);
46
47 6
        session_set_cookie_params($this->lifetime, '/', $this->domain);
48 6
        session_name($this->name);
49 6
        if (session_status() == PHP_SESSION_NONE) {
50 6
            session_start();
51 6
        }
52
    }
53
}