Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
PrivateUser | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
__get | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
save | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
setSession | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Fake database row to represent a user in privacy mode. |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2015. |
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 VuFind\Auth\UserSessionPersistenceInterface; |
33 | |
34 | use function array_key_exists; |
35 | |
36 | /** |
37 | * Fake database row to represent a user in privacy mode. |
38 | * |
39 | * @category VuFind |
40 | * @package Db_Row |
41 | * @author Demian Katz <demian.katz@villanova.edu> |
42 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
43 | * @link https://vufind.org Main Site |
44 | */ |
45 | class PrivateUser extends User |
46 | { |
47 | /** |
48 | * __get |
49 | * |
50 | * @param string $name Field to retrieve. |
51 | * |
52 | * @throws \Laminas\Db\RowGateway\Exception\InvalidArgumentException |
53 | * @return mixed |
54 | */ |
55 | public function __get($name) |
56 | { |
57 | return array_key_exists($name, $this->data) ? parent::__get($name) : null; |
58 | } |
59 | |
60 | /** |
61 | * Save |
62 | * |
63 | * @return int |
64 | */ |
65 | public function save() |
66 | { |
67 | $this->initialize(); |
68 | $this->id = -1; // fake ID |
69 | $this->getDbService(UserSessionPersistenceInterface::class)->addUserDataToSession($this); |
70 | return 1; |
71 | } |
72 | |
73 | /** |
74 | * Set session container |
75 | * |
76 | * @param \Laminas\Session\Container $session Session container |
77 | * |
78 | * @return void |
79 | * |
80 | * @deprecated No longer used or needed |
81 | */ |
82 | public function setSession(\Laminas\Session\Container $session) |
83 | { |
84 | } |
85 | } |