Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
UserLocationPrefs | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
9 | |
100.00% |
1 / 1 |
setUserId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getUserId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setShareLocation | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getShareLocation | 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 user location preferences |
27 | * |
28 | * @category DB |
29 | * @package GNUsocial |
30 | * |
31 | * @author Evan Prodromou <evan@status.net> |
32 | * @copyright 2009 StatusNet Inc. |
33 | * @author Hugo Sales <hugo@hsal.es> |
34 | * @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org |
35 | * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later |
36 | */ |
37 | class UserLocationPrefs extends Entity |
38 | { |
39 | // {{{ Autocode |
40 | // @codeCoverageIgnoreStart |
41 | private int $user_id; |
42 | private ?bool $share_location; |
43 | private \DateTimeInterface $created; |
44 | private \DateTimeInterface $modified; |
45 | |
46 | public function setUserId(int $user_id): self |
47 | { |
48 | $this->user_id = $user_id; |
49 | return $this; |
50 | } |
51 | |
52 | public function getUserId(): int |
53 | { |
54 | return $this->user_id; |
55 | } |
56 | |
57 | public function setShareLocation(?bool $share_location): self |
58 | { |
59 | $this->share_location = $share_location; |
60 | return $this; |
61 | } |
62 | |
63 | public function getShareLocation(): ?bool |
64 | { |
65 | return $this->share_location; |
66 | } |
67 | |
68 | public function setCreated(DateTimeInterface $created): self |
69 | { |
70 | $this->created = $created; |
71 | return $this; |
72 | } |
73 | |
74 | public function getCreated(): DateTimeInterface |
75 | { |
76 | return $this->created; |
77 | } |
78 | |
79 | public function setModified(DateTimeInterface $modified): self |
80 | { |
81 | $this->modified = $modified; |
82 | return $this; |
83 | } |
84 | |
85 | public function getModified(): DateTimeInterface |
86 | { |
87 | return $this->modified; |
88 | } |
89 | |
90 | // @codeCoverageIgnoreEnd |
91 | // }}} Autocode |
92 | |
93 | public static function schemaDef(): array |
94 | { |
95 | return [ |
96 | 'name' => 'user_location_prefs', |
97 | 'fields' => [ |
98 | 'user_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'LocalUser.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'user who has the preference'], |
99 | 'share_location' => ['type' => 'bool', 'default' => true, 'description' => 'Whether to share location data'], |
100 | 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], |
101 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
102 | ], |
103 | 'primary key' => ['user_id'], |
104 | ]; |
105 | } |
106 | } |