Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 1 |
AuthHash | |
0.00% |
0 / 17 |
|
0.00% |
0 / 12 |
156 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSessionId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setSessionId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getHash | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setHash | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getHashType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setHashType | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setData | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getCreated | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCreated | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Row Definition for auth_hash |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2010. |
9 | * Copyright (C) The National Library of Finland 2019. |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2, |
13 | * as published by the Free Software Foundation. |
14 | * |
15 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | * GNU General Public License for more details. |
19 | * |
20 | * You should have received a copy of the GNU General Public License |
21 | * along with this program; if not, write to the Free Software |
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23 | * |
24 | * @category VuFind |
25 | * @package Db_Row |
26 | * @author Demian Katz <demian.katz@villanova.edu> |
27 | * @author Ere Maijala <ere.maijala@helsinki.fi> |
28 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
29 | * @link https://vufind.org Main Site |
30 | */ |
31 | |
32 | namespace VuFind\Db\Row; |
33 | |
34 | use DateTime; |
35 | use VuFind\Db\Entity\AuthHashEntityInterface; |
36 | use VuFind\Db\Service\DbServiceAwareInterface; |
37 | use VuFind\Db\Service\DbServiceAwareTrait; |
38 | |
39 | /** |
40 | * Row Definition for auth_hash |
41 | * |
42 | * @category VuFind |
43 | * @package Db_Row |
44 | * @author Demian Katz <demian.katz@villanova.edu> |
45 | * @author Ere Maijala <ere.maijala@helsinki.fi> |
46 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
47 | * @link https://vufind.org Main Site |
48 | * |
49 | * @property int $id |
50 | * @property string $session_id |
51 | * @property string $hash |
52 | * @property string $type |
53 | * @property string $data |
54 | * @property string $created |
55 | */ |
56 | class AuthHash extends RowGateway implements AuthHashEntityInterface, DbServiceAwareInterface |
57 | { |
58 | use \VuFind\Db\Table\DbTableAwareTrait; |
59 | use DbServiceAwareTrait; |
60 | |
61 | /** |
62 | * Constructor |
63 | * |
64 | * @param \Laminas\Db\Adapter\Adapter $adapter Database adapter |
65 | */ |
66 | public function __construct($adapter) |
67 | { |
68 | parent::__construct('id', 'auth_hash', $adapter); |
69 | } |
70 | |
71 | /** |
72 | * Get identifier (returns null for an uninitialized or non-persisted object). |
73 | * |
74 | * @return ?int |
75 | */ |
76 | public function getId(): ?int |
77 | { |
78 | return $this->id ?? null; |
79 | } |
80 | |
81 | /** |
82 | * Get PHP session id string. |
83 | * |
84 | * @return ?string |
85 | */ |
86 | public function getSessionId(): ?string |
87 | { |
88 | return $this->session_id ?? null; |
89 | } |
90 | |
91 | /** |
92 | * Set PHP session id string. |
93 | * |
94 | * @param ?string $sessionId PHP Session id string |
95 | * |
96 | * @return AuthHashEntityInterface |
97 | */ |
98 | public function setSessionId(?string $sessionId): AuthHashEntityInterface |
99 | { |
100 | $this->session_id = $sessionId; |
101 | return $this; |
102 | } |
103 | |
104 | /** |
105 | * Get hash value. |
106 | * |
107 | * @return string |
108 | */ |
109 | public function getHash(): string |
110 | { |
111 | return $this->hash ?? ''; |
112 | } |
113 | |
114 | /** |
115 | * Set hash value. |
116 | * |
117 | * @param string $hash Hash Value |
118 | * |
119 | * @return AuthHashEntityInterface |
120 | */ |
121 | public function setHash(string $hash): AuthHashEntityInterface |
122 | { |
123 | $this->hash = $hash; |
124 | return $this; |
125 | } |
126 | |
127 | /** |
128 | * Get type of hash. |
129 | * |
130 | * @return ?string |
131 | */ |
132 | public function getHashType(): ?string |
133 | { |
134 | return $this->type ?? null; |
135 | } |
136 | |
137 | /** |
138 | * Set type of hash. |
139 | * |
140 | * @param ?string $type Hash Type |
141 | * |
142 | * @return AuthHashEntityInterface |
143 | */ |
144 | public function setHashType(?string $type): AuthHashEntityInterface |
145 | { |
146 | $this->type = $type; |
147 | return $this; |
148 | } |
149 | |
150 | /** |
151 | * Get data. |
152 | * |
153 | * @return ?string |
154 | */ |
155 | public function getData(): ?string |
156 | { |
157 | return $this->__get('data'); |
158 | } |
159 | |
160 | /** |
161 | * Set data. |
162 | * |
163 | * @param ?string $data Data |
164 | * |
165 | * @return AuthHashEntityInterface |
166 | */ |
167 | public function setData(?string $data): AuthHashEntityInterface |
168 | { |
169 | $this->__set('data', $data); |
170 | return $this; |
171 | } |
172 | |
173 | /** |
174 | * Get created date. |
175 | * |
176 | * @return DateTime |
177 | */ |
178 | public function getCreated(): DateTime |
179 | { |
180 | return DateTime::createFromFormat('Y-m-d H:i:s', $this->created); |
181 | } |
182 | |
183 | /** |
184 | * Set created date. |
185 | * |
186 | * @param DateTime $dateTime Created date |
187 | * |
188 | * @return AuthHashEntityInterface |
189 | */ |
190 | public function setCreated(DateTime $dateTime): AuthHashEntityInterface |
191 | { |
192 | $this->created = $dateTime->format('Y-m-d H:i:s'); |
193 | return $this; |
194 | } |
195 | } |