CoossionsHandler::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
}