Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
2 / 2 |
| GSActorTag | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
10 | |
100.00% |
2 / 2 |
| setTagger | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTagger | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setTagged | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTagged | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setTag | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTag | 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 |
|||
| __toString | |
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 GSActor Tag |
| 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 GSActorTag extends Entity |
| 40 | { |
| 41 | // {{{ Autocode |
| 42 | // @codeCoverageIgnoreStart |
| 43 | private int $tagger; |
| 44 | private int $tagged; |
| 45 | private string $tag; |
| 46 | private \DateTimeInterface $modified; |
| 47 | |
| 48 | public function setTagger(int $tagger): self |
| 49 | { |
| 50 | $this->tagger = $tagger; |
| 51 | return $this; |
| 52 | } |
| 53 | |
| 54 | public function getTagger(): int |
| 55 | { |
| 56 | return $this->tagger; |
| 57 | } |
| 58 | |
| 59 | public function setTagged(int $tagged): self |
| 60 | { |
| 61 | $this->tagged = $tagged; |
| 62 | return $this; |
| 63 | } |
| 64 | |
| 65 | public function getTagged(): int |
| 66 | { |
| 67 | return $this->tagged; |
| 68 | } |
| 69 | |
| 70 | public function setTag(string $tag): self |
| 71 | { |
| 72 | $this->tag = $tag; |
| 73 | return $this; |
| 74 | } |
| 75 | |
| 76 | public function getTag(): string |
| 77 | { |
| 78 | return $this->tag; |
| 79 | } |
| 80 | |
| 81 | public function setModified(DateTimeInterface $modified): self |
| 82 | { |
| 83 | $this->modified = $modified; |
| 84 | return $this; |
| 85 | } |
| 86 | |
| 87 | public function getModified(): DateTimeInterface |
| 88 | { |
| 89 | return $this->modified; |
| 90 | } |
| 91 | |
| 92 | // @codeCoverageIgnoreEnd |
| 93 | // }}} Autocode |
| 94 | |
| 95 | public static function schemaDef(): array |
| 96 | { |
| 97 | return [ |
| 98 | 'name' => 'gsactor_tag', |
| 99 | 'fields' => [ |
| 100 | 'tagger' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'nmae' => 'gsactor_tag_tagger_fkey', 'not null' => true, 'description' => 'user making the tag'], |
| 101 | 'tagged' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'name' => 'gsactor_tag_tagged_fkey', 'not null' => true, 'description' => 'gsactor tagged'], |
| 102 | 'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'], |
| 103 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
| 104 | ], |
| 105 | 'primary key' => ['tagger', 'tagged', 'tag'], |
| 106 | 'indexes' => [ |
| 107 | 'gsactor_tag_modified_idx' => ['modified'], |
| 108 | 'gsactor_tag_tagger_tag_idx' => ['tagger', 'tag'], // For Circles |
| 109 | 'gsactor_tag_tagged_idx' => ['tagged'], |
| 110 | ], |
| 111 | ]; |
| 112 | } |
| 113 | |
| 114 | public function __toString() |
| 115 | { |
| 116 | return $this->tag; |
| 117 | } |
| 118 | } |