Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| NoteLocation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
13 | |
100.00% |
1 / 1 |
| setNoteId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getNoteId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setLat | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getLat | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setLon | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getLon | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setLocationId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getLocationId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setLocationService | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getLocationService | 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 Note's location |
| 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 NoteLocation extends Entity |
| 40 | { |
| 41 | // {{{ Autocode |
| 42 | // @codeCoverageIgnoreStart |
| 43 | private int $note_id; |
| 44 | private ?float $lat; |
| 45 | private ?float $lon; |
| 46 | private ?int $location_id; |
| 47 | private ?int $location_service; |
| 48 | private \DateTimeInterface $modified; |
| 49 | |
| 50 | public function setNoteId(int $note_id): self |
| 51 | { |
| 52 | $this->note_id = $note_id; |
| 53 | return $this; |
| 54 | } |
| 55 | |
| 56 | public function getNoteId(): int |
| 57 | { |
| 58 | return $this->note_id; |
| 59 | } |
| 60 | |
| 61 | public function setLat(?float $lat): self |
| 62 | { |
| 63 | $this->lat = $lat; |
| 64 | return $this; |
| 65 | } |
| 66 | |
| 67 | public function getLat(): ?float |
| 68 | { |
| 69 | return $this->lat; |
| 70 | } |
| 71 | |
| 72 | public function setLon(?float $lon): self |
| 73 | { |
| 74 | $this->lon = $lon; |
| 75 | return $this; |
| 76 | } |
| 77 | |
| 78 | public function getLon(): ?float |
| 79 | { |
| 80 | return $this->lon; |
| 81 | } |
| 82 | |
| 83 | public function setLocationId(?int $location_id): self |
| 84 | { |
| 85 | $this->location_id = $location_id; |
| 86 | return $this; |
| 87 | } |
| 88 | |
| 89 | public function getLocationId(): ?int |
| 90 | { |
| 91 | return $this->location_id; |
| 92 | } |
| 93 | |
| 94 | public function setLocationService(?int $location_service): self |
| 95 | { |
| 96 | $this->location_service = $location_service; |
| 97 | return $this; |
| 98 | } |
| 99 | |
| 100 | public function getLocationService(): ?int |
| 101 | { |
| 102 | return $this->location_service; |
| 103 | } |
| 104 | |
| 105 | public function setModified(DateTimeInterface $modified): self |
| 106 | { |
| 107 | $this->modified = $modified; |
| 108 | return $this; |
| 109 | } |
| 110 | |
| 111 | public function getModified(): DateTimeInterface |
| 112 | { |
| 113 | return $this->modified; |
| 114 | } |
| 115 | |
| 116 | // @codeCoverageIgnoreEnd |
| 117 | // }}} Autocode |
| 118 | |
| 119 | public static function schemaDef(): array |
| 120 | { |
| 121 | return [ |
| 122 | 'name' => 'activity_location', |
| 123 | 'fields' => [ |
| 124 | 'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'name' => 'note_location_note_id_fkey', 'not null' => true, 'description' => 'activity this refers to'], |
| 125 | 'lat' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'], |
| 126 | 'lon' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'], |
| 127 | 'location_id' => ['type' => 'int', 'description' => 'location id if possible'], |
| 128 | 'location_service' => ['type' => 'int', 'size' => 'tiny', 'description' => 'service used to retrieve location information'], |
| 129 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
| 130 | ], |
| 131 | 'primary key' => ['note_id'], |
| 132 | 'indexes' => [ |
| 133 | 'note_location_location_id_idx' => ['location_id'], |
| 134 | ], |
| 135 | ]; |
| 136 | } |
| 137 | } |