Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
Group | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
37 | |
100.00% |
1 / 1 |
setId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setGSActorId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getGSActorId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setNickname | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getNickname | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setFullname | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getFullname | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setHomepage | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getHomepage | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setDescription | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getDescription | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setIsLocal | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getIsLocal | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setLocation | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getLocation | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setOriginalLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getOriginalLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setHomepageLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getHomepageLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setStreamLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getStreamLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setMiniLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getMiniLogo | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setUri | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getUri | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setMainpage | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getMainpage | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setJoinPolicy | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getJoinPolicy | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setForceScope | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getForceScope | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setCreated | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getCreated | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setModified | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getModified | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
schemaDef | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
1 | <?php |
2 | |
3 | // {{{ License |
4 | // This file is part of GNU social - https://www.gnu.org/software/social |
5 | // |
6 | // GNU social is free software: you can redistribute it and/or modify |
7 | // it under the terms of the GNU Affero General Public License as published by |
8 | // the Free Software Foundation, either version 3 of the License, or |
9 | // (at your option) any later version. |
10 | // |
11 | // GNU social is distributed in the hope that it will be useful, |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | // GNU Affero General Public License for more details. |
15 | // |
16 | // You should have received a copy of the GNU Affero General Public License |
17 | // along with GNU social. If not, see <http://www.gnu.org/licenses/>. |
18 | // }}} |
19 | |
20 | namespace App\Entity; |
21 | |
22 | use App\Core\Entity; |
23 | use DateTimeInterface; |
24 | |
25 | /** |
26 | * Entity for groups a user is in |
27 | * |
28 | * @category DB |
29 | * @package GNUsocial |
30 | * |
31 | * @author Zach Copley <zach@status.net> |
32 | * @copyright 2010 StatusNet Inc. |
33 | * @author Mikael Nordfeldth <mmn@hethane.se> |
34 | * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org |
35 | * @author Hugo Sales <hugo@hsal.es> |
36 | * @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org |
37 | * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later |
38 | */ |
39 | class Group extends Entity |
40 | { |
41 | // {{{ Autocode |
42 | // @codeCoverageIgnoreStart |
43 | private int $id; |
44 | private int $gsactor_id; |
45 | private ?string $nickname; |
46 | private ?string $fullname; |
47 | private ?string $homepage; |
48 | private ?string $description; |
49 | private ?bool $is_local; |
50 | private ?string $location; |
51 | private ?string $original_logo; |
52 | private ?string $homepage_logo; |
53 | private ?string $stream_logo; |
54 | private ?string $mini_logo; |
55 | private ?string $uri; |
56 | private ?string $mainpage; |
57 | private ?int $join_policy; |
58 | private ?int $force_scope; |
59 | private \DateTimeInterface $created; |
60 | private \DateTimeInterface $modified; |
61 | |
62 | public function setId(int $id): self |
63 | { |
64 | $this->id = $id; |
65 | return $this; |
66 | } |
67 | |
68 | public function getId(): int |
69 | { |
70 | return $this->id; |
71 | } |
72 | |
73 | public function setGSActorId(int $gsactor_id): self |
74 | { |
75 | $this->gsactor_id = $gsactor_id; |
76 | return $this; |
77 | } |
78 | |
79 | public function getGSActorId(): int |
80 | { |
81 | return $this->gsactor_id; |
82 | } |
83 | |
84 | public function setNickname(?string $nickname): self |
85 | { |
86 | $this->nickname = $nickname; |
87 | return $this; |
88 | } |
89 | |
90 | public function getNickname(): ?string |
91 | { |
92 | return $this->nickname; |
93 | } |
94 | |
95 | public function setFullname(?string $fullname): self |
96 | { |
97 | $this->fullname = $fullname; |
98 | return $this; |
99 | } |
100 | |
101 | public function getFullname(): ?string |
102 | { |
103 | return $this->fullname; |
104 | } |
105 | |
106 | public function setHomepage(?string $homepage): self |
107 | { |
108 | $this->homepage = $homepage; |
109 | return $this; |
110 | } |
111 | |
112 | public function getHomepage(): ?string |
113 | { |
114 | return $this->homepage; |
115 | } |
116 | |
117 | public function setDescription(?string $description): self |
118 | { |
119 | $this->description = $description; |
120 | return $this; |
121 | } |
122 | |
123 | public function getDescription(): ?string |
124 | { |
125 | return $this->description; |
126 | } |
127 | |
128 | public function setIsLocal(?bool $is_local): self |
129 | { |
130 | $this->is_local = $is_local; |
131 | return $this; |
132 | } |
133 | |
134 | public function getIsLocal(): ?bool |
135 | { |
136 | return $this->is_local; |
137 | } |
138 | |
139 | public function setLocation(?string $location): self |
140 | { |
141 | $this->location = $location; |
142 | return $this; |
143 | } |
144 | |
145 | public function getLocation(): ?string |
146 | { |
147 | return $this->location; |
148 | } |
149 | |
150 | public function setOriginalLogo(?string $original_logo): self |
151 | { |
152 | $this->original_logo = $original_logo; |
153 | return $this; |
154 | } |
155 | |
156 | public function getOriginalLogo(): ?string |
157 | { |
158 | return $this->original_logo; |
159 | } |
160 | |
161 | public function setHomepageLogo(?string $homepage_logo): self |
162 | { |
163 | $this->homepage_logo = $homepage_logo; |
164 | return $this; |
165 | } |
166 | |
167 | public function getHomepageLogo(): ?string |
168 | { |
169 | return $this->homepage_logo; |
170 | } |
171 | |
172 | public function setStreamLogo(?string $stream_logo): self |
173 | { |
174 | $this->stream_logo = $stream_logo; |
175 | return $this; |
176 | } |
177 | |
178 | public function getStreamLogo(): ?string |
179 | { |
180 | return $this->stream_logo; |
181 | } |
182 | |
183 | public function setMiniLogo(?string $mini_logo): self |
184 | { |
185 | $this->mini_logo = $mini_logo; |
186 | return $this; |
187 | } |
188 | |
189 | public function getMiniLogo(): ?string |
190 | { |
191 | return $this->mini_logo; |
192 | } |
193 | |
194 | public function setUri(?string $uri): self |
195 | { |
196 | $this->uri = $uri; |
197 | return $this; |
198 | } |
199 | |
200 | public function getUri(): ?string |
201 | { |
202 | return $this->uri; |
203 | } |
204 | |
205 | public function setMainpage(?string $mainpage): self |
206 | { |
207 | $this->mainpage = $mainpage; |
208 | return $this; |
209 | } |
210 | |
211 | public function getMainpage(): ?string |
212 | { |
213 | return $this->mainpage; |
214 | } |
215 | |
216 | public function setJoinPolicy(?int $join_policy): self |
217 | { |
218 | $this->join_policy = $join_policy; |
219 | return $this; |
220 | } |
221 | |
222 | public function getJoinPolicy(): ?int |
223 | { |
224 | return $this->join_policy; |
225 | } |
226 | |
227 | public function setForceScope(?int $force_scope): self |
228 | { |
229 | $this->force_scope = $force_scope; |
230 | return $this; |
231 | } |
232 | |
233 | public function getForceScope(): ?int |
234 | { |
235 | return $this->force_scope; |
236 | } |
237 | |
238 | public function setCreated(DateTimeInterface $created): self |
239 | { |
240 | $this->created = $created; |
241 | return $this; |
242 | } |
243 | |
244 | public function getCreated(): DateTimeInterface |
245 | { |
246 | return $this->created; |
247 | } |
248 | |
249 | public function setModified(DateTimeInterface $modified): self |
250 | { |
251 | $this->modified = $modified; |
252 | return $this; |
253 | } |
254 | |
255 | public function getModified(): DateTimeInterface |
256 | { |
257 | return $this->modified; |
258 | } |
259 | |
260 | // @codeCoverageIgnoreEnd |
261 | // }}} Autocode |
262 | |
263 | public static function schemaDef(): array |
264 | { |
265 | return [ |
266 | 'name' => '`group`', |
267 | 'fields' => [ |
268 | 'id' => ['type' => 'serial', 'not null' => true], |
269 | 'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'foreign key to gsactor table'], |
270 | 'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname for addressing'], |
271 | 'fullname' => ['type' => 'varchar', 'length' => 191, 'description' => 'display name'], |
272 | 'homepage' => ['type' => 'varchar', 'length' => 191, 'description' => 'URL, cached so we dont regenerate'], |
273 | 'description' => ['type' => 'text', 'description' => 'group description'], |
274 | 'is_local' => ['type' => 'bool', 'description' => 'whether this group was created in this instance'], |
275 | 'location' => ['type' => 'varchar', 'length' => 191, 'description' => 'related physical location, if any'], |
276 | 'original_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'original size logo'], |
277 | 'homepage_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'homepage (gsactor) size logo'], |
278 | 'stream_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'stream-sized logo'], |
279 | 'mini_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'mini logo'], |
280 | 'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'], |
281 | 'mainpage' => ['type' => 'varchar', 'length' => 191, 'description' => 'page for group info to link to'], |
282 | 'join_policy' => ['type' => 'int', 'size' => 'tiny', 'description' => '0=open; 1=requires admin approval'], |
283 | 'force_scope' => ['type' => 'int', 'size' => 'tiny', 'description' => '0=never,1=sometimes,-1=always'], |
284 | 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], |
285 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
286 | ], |
287 | 'primary key' => ['id'], |
288 | 'unique keys' => [ |
289 | 'user_group_uri_key' => ['uri'], |
290 | 'user_gsactor_id_key' => ['gsactor_id'], |
291 | ], |
292 | 'indexes' => [ |
293 | 'user_group_nickname_idx' => ['nickname'], |
294 | 'user_group_gsactor_id_idx' => ['gsactor_id'], |
295 | ], |
296 | ]; |
297 | } |
298 | } |