Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 1 |
Record | |
0.00% |
0 / 19 |
|
0.00% |
0 / 12 |
182 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRecordId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setRecordId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getSource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setSource | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getVersion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setVersion | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getData | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
setData | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getUpdated | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setUpdated | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Row Definition for record |
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 Markus Beh <markus.beh@ub.uni-freiburg.de> |
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 Exception; |
34 | use VuFind\Db\Entity\RecordEntityInterface; |
35 | |
36 | /** |
37 | * Row Definition for user |
38 | * |
39 | * @category VuFind |
40 | * @package Db_Row |
41 | * @author Markus Beh <markus.beh@ub.uni-freiburg.de> |
42 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
43 | * @link https://vufind.org Main Site |
44 | * |
45 | * @property int $id |
46 | * @property string $record_id |
47 | * @property string $source |
48 | * @property string $version |
49 | * @property string $updated |
50 | */ |
51 | class Record extends RowGateway implements RecordEntityInterface |
52 | { |
53 | /** |
54 | * Constructor |
55 | * |
56 | * @param \Laminas\Db\Adapter\Adapter $adapter Database adapter |
57 | */ |
58 | public function __construct($adapter) |
59 | { |
60 | parent::__construct('id', 'record', $adapter); |
61 | } |
62 | |
63 | /** |
64 | * Get identifier (returns null for an uninitialized or non-persisted object). |
65 | * |
66 | * @return ?int |
67 | */ |
68 | public function getId(): ?int |
69 | { |
70 | return $this->id ?? null; |
71 | } |
72 | |
73 | /** |
74 | * Get record id. |
75 | * |
76 | * @return ?string |
77 | */ |
78 | public function getRecordId(): ?string |
79 | { |
80 | return $this->record_id ?? null; |
81 | } |
82 | |
83 | /** |
84 | * Set record id. |
85 | * |
86 | * @param ?string $recordId Record id |
87 | * |
88 | * @return RecordEntityInterface |
89 | */ |
90 | public function setRecordId(?string $recordId): RecordEntityInterface |
91 | { |
92 | $this->record_id = $recordId; |
93 | return $this; |
94 | } |
95 | |
96 | /** |
97 | * Get record source. |
98 | * |
99 | * @return ?string |
100 | */ |
101 | public function getSource(): ?string |
102 | { |
103 | return $this->source ?? null; |
104 | } |
105 | |
106 | /** |
107 | * Set record source. |
108 | * |
109 | * @param ?string $recordSource Record source |
110 | * |
111 | * @return RecordEntityInterface |
112 | */ |
113 | public function setSource(?string $recordSource): RecordEntityInterface |
114 | { |
115 | $this->source = $recordSource; |
116 | return $this; |
117 | } |
118 | |
119 | /** |
120 | * Get record version. |
121 | * |
122 | * @return string |
123 | */ |
124 | public function getVersion(): string |
125 | { |
126 | return $this->version ?? ''; |
127 | } |
128 | |
129 | /** |
130 | * Set record version. |
131 | * |
132 | * @param string $recordVersion Record version |
133 | * |
134 | * @return RecordEntityInterface |
135 | */ |
136 | public function setVersion(string $recordVersion): RecordEntityInterface |
137 | { |
138 | $this->version = $recordVersion; |
139 | return $this; |
140 | } |
141 | |
142 | /** |
143 | * Get record data. |
144 | * |
145 | * @return ?string |
146 | */ |
147 | public function getData(): ?string |
148 | { |
149 | try { |
150 | return $this->__get('data'); |
151 | } catch (Exception) { |
152 | return null; |
153 | } |
154 | } |
155 | |
156 | /** |
157 | * Set record data. |
158 | * |
159 | * @param ?string $recordData Record data |
160 | * |
161 | * @return RecordEntityInterface |
162 | */ |
163 | public function setData(?string $recordData): RecordEntityInterface |
164 | { |
165 | $this->__set('data', $recordData); |
166 | return $this; |
167 | } |
168 | |
169 | /** |
170 | * Get updated date. |
171 | * |
172 | * @return DateTime |
173 | */ |
174 | public function getUpdated(): DateTime |
175 | { |
176 | return DateTime::createFromFormat('Y-m-d H:i:s', $this->updated); |
177 | } |
178 | |
179 | /** |
180 | * Set updated date. |
181 | * |
182 | * @param DateTime $dateTime Updated date |
183 | * |
184 | * @return RecordEntityInterface |
185 | */ |
186 | public function setUpdated(DateTime $dateTime): RecordEntityInterface |
187 | { |
188 | $this->updated = $dateTime->format('Y-m-d H:i:s'); |
189 | return $this; |
190 | } |
191 | } |