ServerDriver::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of slick/http
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Slick\Http\Session\Driver;
13
14
use Slick\Http\Session\SessionDriverInterface;
15
16
/**
17
 * ServerDriver
18
 *
19
 * @package Slick\Http\Session\Driver
20
*/
21
class ServerDriver extends AbstractDriver implements SessionDriverInterface
22
{
23
    /**
24
     * Creates a Server Session Driver
25
     *
26
     * @param array<string, mixed> $options
27
     */
28
    public function __construct(array $options = [])
29
    {
30
        parent::__construct($options);
31
32
        session_set_cookie_params($this->lifetime, '/', $this->domain);
33
        session_name($this->name);
34
        if (session_status() !== PHP_SESSION_ACTIVE) {
35
            session_start();
36
        }
37
    }
38
}
39