Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ConfirmAddress | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
17 | |
100.00% |
1 / 1 |
| setCode | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getCode | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setUserId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getUserId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setAddress | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getAddress | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setAddressExtra | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getAddressExtra | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setAddressType | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getAddressType | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setClaimed | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getClaimed | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setSent | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getSent | 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's email confimation |
| 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 ConfirmAddress extends Entity |
| 40 | { |
| 41 | // {{{ Autocode |
| 42 | // @codeCoverageIgnoreStart |
| 43 | private string $code; |
| 44 | private ?int $user_id; |
| 45 | private string $address; |
| 46 | private ?string $address_extra; |
| 47 | private string $address_type; |
| 48 | private ?\DateTimeInterface $claimed; |
| 49 | private \DateTimeInterface $sent; |
| 50 | private \DateTimeInterface $modified; |
| 51 | |
| 52 | public function setCode(string $code): self |
| 53 | { |
| 54 | $this->code = $code; |
| 55 | return $this; |
| 56 | } |
| 57 | |
| 58 | public function getCode(): string |
| 59 | { |
| 60 | return $this->code; |
| 61 | } |
| 62 | |
| 63 | public function setUserId(?int $user_id): self |
| 64 | { |
| 65 | $this->user_id = $user_id; |
| 66 | return $this; |
| 67 | } |
| 68 | |
| 69 | public function getUserId(): ?int |
| 70 | { |
| 71 | return $this->user_id; |
| 72 | } |
| 73 | |
| 74 | public function setAddress(string $address): self |
| 75 | { |
| 76 | $this->address = $address; |
| 77 | return $this; |
| 78 | } |
| 79 | |
| 80 | public function getAddress(): string |
| 81 | { |
| 82 | return $this->address; |
| 83 | } |
| 84 | |
| 85 | public function setAddressExtra(?string $address_extra): self |
| 86 | { |
| 87 | $this->address_extra = $address_extra; |
| 88 | return $this; |
| 89 | } |
| 90 | |
| 91 | public function getAddressExtra(): ?string |
| 92 | { |
| 93 | return $this->address_extra; |
| 94 | } |
| 95 | |
| 96 | public function setAddressType(string $address_type): self |
| 97 | { |
| 98 | $this->address_type = $address_type; |
| 99 | return $this; |
| 100 | } |
| 101 | |
| 102 | public function getAddressType(): string |
| 103 | { |
| 104 | return $this->address_type; |
| 105 | } |
| 106 | |
| 107 | public function setClaimed(?DateTimeInterface $claimed): self |
| 108 | { |
| 109 | $this->claimed = $claimed; |
| 110 | return $this; |
| 111 | } |
| 112 | |
| 113 | public function getClaimed(): ?DateTimeInterface |
| 114 | { |
| 115 | return $this->claimed; |
| 116 | } |
| 117 | |
| 118 | public function setSent(DateTimeInterface $sent): self |
| 119 | { |
| 120 | $this->sent = $sent; |
| 121 | return $this; |
| 122 | } |
| 123 | |
| 124 | public function getSent(): DateTimeInterface |
| 125 | { |
| 126 | return $this->sent; |
| 127 | } |
| 128 | |
| 129 | public function setModified(DateTimeInterface $modified): self |
| 130 | { |
| 131 | $this->modified = $modified; |
| 132 | return $this; |
| 133 | } |
| 134 | |
| 135 | public function getModified(): DateTimeInterface |
| 136 | { |
| 137 | return $this->modified; |
| 138 | } |
| 139 | |
| 140 | // @codeCoverageIgnoreEnd |
| 141 | // }}} Autocode |
| 142 | |
| 143 | public static function schemaDef(): array |
| 144 | { |
| 145 | return [ |
| 146 | 'name' => 'confirm_address', |
| 147 | 'fields' => [ |
| 148 | 'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'], |
| 149 | 'user_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'LocalUser.id', 'name' => 'confirm_address_user_id_fkey', 'multiplicity' => 'one to one', 'default' => 0, 'description' => 'user who requested confirmation'], |
| 150 | 'address' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'], |
| 151 | 'address_extra' => ['type' => 'varchar', 'length' => 191, 'description' => 'carrier ID, for SMS'], |
| 152 | 'address_type' => ['type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'], |
| 153 | 'claimed' => ['type' => 'datetime', 'description' => 'date this was claimed for queueing'], |
| 154 | 'sent' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this was sent for queueing'], |
| 155 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
| 156 | ], |
| 157 | 'primary key' => ['code'], |
| 158 | ]; |
| 159 | } |
| 160 | } |