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.

Dba   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 2

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load() 0 4 1
A save() 0 4 1
A delete() 0 4 1
A clean() 0 8 2
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\Contracts\Cleanable;
12
13
/**
14
 * @package Session_Storages
15
 * @author  Gjero Krsteski <[email protected]>
16
 */
17
class Dba extends Storage implements Cleanable
18
{
19
    /**
20
     * @var \Pimf\Cache\Storages\Dba
21
     */
22
    private $dba;
23
24
    /**
25
     * @param \Pimf\Cache\Storages\Dba $dba
26
     */
27
    public function __construct(\Pimf\Cache\Storages\Dba $dba)
28
    {
29
        $this->dba = $dba;
30
    }
31
32
    /**
33
     * Load a session from storage by a given ID.
34
     *
35
     * @param string $key
36
     *
37
     * @return array|mixed
38
     */
39
    public function load($key)
40
    {
41
        return $this->dba->get($key);
42
    }
43
44
    /**
45
     * Save a given session to storage.
46
     *
47
     * @param array $session
48
     * @param array $config
49
     * @param bool  $exists
50
     */
51
    public function save($session, $config, $exists)
52
    {
53
        $this->dba->put($session['id'], $session, $config['lifetime']);
54
    }
55
56
    /**
57
     * @param string $key
58
     */
59
    public function delete($key)
60
    {
61
        $this->dba->forget($key);
62
    }
63
64
    /**
65
     * Delete all expired sessions from persistent storage.
66
     *
67
     * @param int $expiration
68
     *
69
     * @return mixed|void
70
     */
71
    public function clean($expiration)
72
    {
73
        $this->dba->clean();
74
75
        if (filemtime($this->dba->getFile()) < $expiration) {
76
            $this->dba->flush();
77
        }
78
    }
79
}
80