Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
Session | |
0.00% |
0 / 12 |
|
0.00% |
0 / 8 |
72 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setSessionId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setCreated | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setLastUsed | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getLastUsed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setData | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Row Definition for session |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2010. |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2, |
12 | * as published by the Free Software Foundation. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | * |
23 | * @category VuFind |
24 | * @package Db_Row |
25 | * @author Demian Katz <demian.katz@villanova.edu> |
26 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
27 | * @link https://vufind.org Main Site |
28 | */ |
29 | |
30 | namespace VuFind\Db\Row; |
31 | |
32 | use DateTime; |
33 | use VuFind\Db\Entity\SessionEntityInterface; |
34 | |
35 | /** |
36 | * Row Definition for session |
37 | * |
38 | * @category VuFind |
39 | * @package Db_Row |
40 | * @author Demian Katz <demian.katz@villanova.edu> |
41 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
42 | * @link https://vufind.org Main Site |
43 | * |
44 | * @property int $id |
45 | * @property ?string $session_id |
46 | * @property string $data |
47 | * @property int $last_used |
48 | * @property string $created |
49 | */ |
50 | class Session extends RowGateway implements SessionEntityInterface |
51 | { |
52 | /** |
53 | * Constructor |
54 | * |
55 | * @param \Laminas\Db\Adapter\Adapter $adapter Database adapter |
56 | */ |
57 | public function __construct($adapter) |
58 | { |
59 | parent::__construct('id', 'session', $adapter); |
60 | } |
61 | |
62 | /** |
63 | * Id getter |
64 | * |
65 | * @return int |
66 | */ |
67 | public function getId(): int |
68 | { |
69 | return $this->id; |
70 | } |
71 | |
72 | /** |
73 | * Session Id setter |
74 | * |
75 | * @param ?string $sid Session Id. |
76 | * |
77 | * @return SessionEntityInterface |
78 | */ |
79 | public function setSessionId(?string $sid): SessionEntityInterface |
80 | { |
81 | $this->session_id = $sid; |
82 | return $this; |
83 | } |
84 | |
85 | /** |
86 | * Created setter. |
87 | * |
88 | * @param DateTime $dateTime Created date |
89 | * |
90 | * @return SessionEntityInterface |
91 | */ |
92 | public function setCreated(DateTime $dateTime): SessionEntityInterface |
93 | { |
94 | $this->created = $dateTime->format('Y-m-d H:i:s'); |
95 | return $this; |
96 | } |
97 | |
98 | /** |
99 | * Set time the session is last used. |
100 | * |
101 | * @param int $lastUsed Time last used |
102 | * |
103 | * @return SessionEntityInterface |
104 | */ |
105 | public function setLastUsed(int $lastUsed): SessionEntityInterface |
106 | { |
107 | $this->last_used = $lastUsed; |
108 | return $this; |
109 | } |
110 | |
111 | /** |
112 | * Get time when the session was last used. |
113 | * |
114 | * @return int |
115 | */ |
116 | public function getLastUsed(): int |
117 | { |
118 | return $this->last_used; |
119 | } |
120 | |
121 | /** |
122 | * Session data setter. |
123 | * |
124 | * @param ?string $data Session data. |
125 | * |
126 | * @return SessionEntityInterface |
127 | */ |
128 | public function setData(?string $data): SessionEntityInterface |
129 | { |
130 | $this->data = $data; |
131 | return $this; |
132 | } |
133 | |
134 | /** |
135 | * Get session data. |
136 | * |
137 | * @return ?string |
138 | */ |
139 | public function getData(): ?string |
140 | { |
141 | return $this->data; |
142 | } |
143 | } |