CoossionsHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 24
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A startSession() 0 7 3
1
<?php
2
namespace coossions;
3
4
use coossions\base\Coossions;
5
use coossions\base\CoossionsContractInterface;
6
7
class CoossionsHandler extends Coossions implements CoossionsContractInterface
8
{
9
    /**
10
     * Coossions constructor.
11
     * @param string $secret the secret key to be used in openssl_digest
12
     */
13
    public function __construct(string $secret)
14
    {
15
        parent::__construct($secret);
16
    }
17
18
    /**
19
     * Starts session with SessionHandlerInterface impl + cookie encryption
20
     *
21
     * @param bool $start if true session starts manually, set to false if php.ini session.autostart = 1
22
     */
23
    public function startSession(bool $start = true)
24
    {
25
        session_set_save_handler($this);
26
        if(true === $start && session_status() === PHP_SESSION_NONE) {
27
            session_start();
28
        }
29
    }
30
}