SessionFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 26
rs 10
c 2
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 19 2
1
<?php
2
/**
3
 * @package EBloodBank
4
 * @since   1.6
5
 */
6
namespace EBloodBank;
7
8
use Aura\Session;
9
use Psr\Container\ContainerInterface;
10
11
/**
12
 * @since 1.6
13
 */
14
class SessionFactory
15
{
16
    /**
17
     * @param  ContainerInterface $container
18
     * @return \Aura\Session\Session
19
     * @since  1.6
20
     */
21
    public function __invoke(ContainerInterface $container)
22
    {
23
        $sessionFactory = new Session\SessionFactory();
24
        $session = $sessionFactory->newInstance($_COOKIE);
25
26
        if (! $session->isStarted()) {
27
            $session->setName('EBB_SESSION_ID');
28
            $session->setCookieParams(
29
                [
30
                    'lifetime' => 3600,
31
                    'path'     => parse_url(getHomeURL(), PHP_URL_PATH),
32
                    'secure'   => isHTTPS(),
33
                    'httponly' => true,
34
                ]
35
            );
36
            $session->start();
37
        }
38
39
        return $session;
40
    }
41
}
42