GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Cookie::save()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Pimf
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\Session\Storages;
10
11
use Pimf\Cookie as Crumb;
12
13
/**
14
 * @package Session_Storages
15
 * @author  Gjero Krsteski <[email protected]>
16
 */
17
class Cookie extends Storage
18
{
19
    /**
20
     * The name of the cookie used to store the session payload.
21
     *
22
     * @var string
23
     */
24
    const PAYLOAD = 'session_payload';
25
26
    /**
27
     * Load a session from storage by a given ID.
28
     *
29
     * @param  string $key
30
     *
31
     * @return array|null
32
     */
33
    public function load($key)
34
    {
35
        if (Crumb::has(static::PAYLOAD)) {
36
            return unserialize(base64_decode(Crumb::get(static::PAYLOAD)));
37
        }
38
39
        return null;
40
    }
41
42
    /**
43
     * Save a given session to storage.
44
     *
45
     * @param array $session
46
     * @param array $config
47
     * @param bool  $exists
48
     */
49
    public function save($session, $config, $exists)
50
    {
51
        Crumb::put(static::PAYLOAD, base64_encode(serialize($session)), $config['lifetime'], $config['path'],
52
            $config['domain']);
53
    }
54
55
    /**
56
     * @param string $key
57
     */
58
    public function delete($key)
59
    {
60
        Crumb::forget(static::PAYLOAD);
61
    }
62
}
63