Completed
Push — master ( 89b9bc...4042b6 )
by André
102:57 queued 84:06
created

NativeSessionHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
1
<?php
2
3
/**
4
 * File containing the NativeSessionHandler class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\Session\Handler;
10
11
/**
12
 * Class NativeSessionHandler.
13
 *
14
 * This class makes it possible to configure the native PHP session handler.
15
 */
16
class NativeSessionHandler extends \SessionHandler
17
{
18
    /**
19
     * @param string $savePath      Path of directory to save session files
20
     *                              Default null will leave setting as defined by PHP.
21
     *                              '/path', 'host:port'
22
     * @param string $saveHandler   Could be any handler supported by php
23
     *                              Default null will leave setting as defined by PHP.
24
     *                              'redis', 'file'
25
     *
26
     * @see http://php.net/manual/en/session.configuration.php#ini.session.save-path for further details.
27
     */
28
    public function __construct($savePath = null, $saveHandler = null)
29
    {
30
        if (null !== $savePath) {
31
            ini_set('session.save_path', $savePath);
32
        }
33
34
        if (null !== $saveHandler) {
35
            ini_set('session.save_handler', $saveHandler);
36
        }
37
    }
38
}
39