Completed
Push — master ( 480535...7e0bd3 )
by Anton
12s
created

Session::initInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link      https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Proxy;
12
13
use Bluz\Session\Session as Instance;
14
15
/**
16
 * Proxy to Session
17
 *
18
 * Example of usage
19
 * <code>
20
 *     use Bluz\Proxy\Session;
21
 *
22
 *     // lazy session loading
23
 *     Session::set('some key in session', 'value example');
24
 *     Session::get('some key in session');
25
 * </code>
26
 *
27
 * @package  Bluz\Proxy
28
 * @author   Anton Shevchuk
29
 *
30
 * @method   static Instance getInstance()
31
 *
32
 * @method   static void  start()
33
 * @see      Instance::start()
34
 * @method   static void  destroy()
35
 * @see      Instance::destroy()
36
 * @method   static void  set($key, $value)
37
 * @see      Instance::set()
38
 * @method   static mixed get($key)
39
 * @see      Instance::get()
40
 * @method   static bool  contains($key)
41
 * @see      Instance::contains()
42
 * @method   static void  delete($key)
43
 * @see      Instance::delete()
44
 * @method   static string getId()
45
 * @see      Instance::getId()
46
 * @method   static bool  regenerateId($deleteOldSession = true)
47
 * @see      Instance::regenerateId()
48
 * @method   static void  setSessionCookieLifetime($ttl)
49
 * @see      Instance::setSessionCookieLifetime()
50
 *
51
 * @method   static void  expireSessionCookie()
52
 */
53
final class Session
54
{
55
    use ProxyTrait;
56
57
    /**
58
     * Init instance
59
     *
60
     * @return Instance
61
     */
62 1
    protected static function initInstance()
63
    {
64 1
        $instance = new Instance();
65 1
        $instance->setOptions(Config::getData('session'));
66 1
        return $instance;
67
    }
68
}
69