nuxsmin /
sysPass
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * sysPass |
||
| 4 | * |
||
| 5 | * @author nuxsmin |
||
| 6 | * @link https://syspass.org |
||
| 7 | * @copyright 2012-2019, Rubén Domínguez nuxsmin@$syspass.org |
||
| 8 | * |
||
| 9 | * This file is part of sysPass. |
||
| 10 | * |
||
| 11 | * sysPass is free software: you can redistribute it and/or modify |
||
| 12 | * it under the terms of the GNU General Public License as published by |
||
| 13 | * the Free Software Foundation, either version 3 of the License, or |
||
| 14 | * (at your option) any later version. |
||
| 15 | * |
||
| 16 | * sysPass is distributed in the hope that it will be useful, |
||
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 19 | * GNU General Public License for more details. |
||
| 20 | * |
||
| 21 | * You should have received a copy of the GNU General Public License |
||
| 22 | * along with sysPass. If not, see <http://www.gnu.org/licenses/>. |
||
| 23 | */ |
||
| 24 | |||
| 25 | namespace SP\DataModel; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Class ItemPresetData |
||
| 29 | * |
||
| 30 | * @package SP\DataModel |
||
| 31 | */ |
||
| 32 | class ItemPresetData extends DataModelBase implements HydratableInterface |
||
| 33 | { |
||
| 34 | use SerializedModel; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var int |
||
| 38 | */ |
||
| 39 | public $id; |
||
| 40 | /** |
||
| 41 | * @var string |
||
| 42 | */ |
||
| 43 | public $type; |
||
| 44 | /** |
||
| 45 | * @var int |
||
| 46 | */ |
||
| 47 | public $userId; |
||
| 48 | /** |
||
| 49 | * @var int |
||
| 50 | */ |
||
| 51 | public $userGroupId; |
||
| 52 | /** |
||
| 53 | * @var int |
||
| 54 | */ |
||
| 55 | public $userProfileId; |
||
| 56 | /** |
||
| 57 | * @var int |
||
| 58 | */ |
||
| 59 | public $fixed; |
||
| 60 | /** |
||
| 61 | * @var int |
||
| 62 | */ |
||
| 63 | public $priority; |
||
| 64 | /** |
||
| 65 | * @var string |
||
| 66 | */ |
||
| 67 | public $data; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return int |
||
| 71 | */ |
||
| 72 | public function getId(): int |
||
| 73 | { |
||
| 74 | return $this->id !== null ? (int)$this->id : null; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param int $id |
||
| 79 | * |
||
| 80 | * @return ItemPresetData |
||
| 81 | */ |
||
| 82 | public function setId(int $id) |
||
| 83 | { |
||
| 84 | $this->id = $id; |
||
| 85 | |||
| 86 | return $this; |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @return int |
||
| 91 | */ |
||
| 92 | public function getUserId() |
||
| 93 | { |
||
| 94 | return $this->userId !== null ? (int)$this->userId : null; |
||
| 95 | } |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @param int $userId |
||
| 99 | * |
||
| 100 | * @return ItemPresetData |
||
| 101 | */ |
||
| 102 | public function setUserId(int $userId) |
||
| 103 | { |
||
| 104 | $this->userId = $userId; |
||
| 105 | |||
| 106 | return $this; |
||
| 107 | } |
||
| 108 | |||
| 109 | /** |
||
| 110 | * @return int |
||
| 111 | */ |
||
| 112 | public function getUserGroupId() |
||
| 113 | { |
||
| 114 | return $this->userGroupId !== null ? (int)$this->userGroupId : null; |
||
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @param int $userGroupId |
||
| 119 | * |
||
| 120 | * @return ItemPresetData |
||
| 121 | */ |
||
| 122 | public function setUserGroupId(int $userGroupId) |
||
| 123 | { |
||
| 124 | $this->userGroupId = $userGroupId; |
||
| 125 | |||
| 126 | return $this; |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * @return int |
||
| 131 | */ |
||
| 132 | public function getUserProfileId() |
||
| 133 | { |
||
| 134 | return $this->userProfileId !== null ? (int)$this->userProfileId : null; |
||
| 135 | } |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @param int $userProfileId |
||
| 139 | * |
||
| 140 | * @return ItemPresetData |
||
| 141 | */ |
||
| 142 | public function setUserProfileId(int $userProfileId) |
||
| 143 | { |
||
| 144 | $this->userProfileId = $userProfileId; |
||
| 145 | |||
| 146 | return $this; |
||
| 147 | } |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @return int |
||
| 151 | */ |
||
| 152 | public function getFixed(): int |
||
| 153 | { |
||
| 154 | return (int)$this->fixed; |
||
| 155 | } |
||
| 156 | |||
| 157 | /** |
||
| 158 | * @param int $fixed |
||
| 159 | * |
||
| 160 | * @return ItemPresetData |
||
| 161 | */ |
||
| 162 | public function setFixed(int $fixed) |
||
| 163 | { |
||
| 164 | $this->fixed = $fixed; |
||
| 165 | |||
| 166 | return $this; |
||
| 167 | } |
||
| 168 | |||
| 169 | /** |
||
| 170 | * @return int |
||
| 171 | */ |
||
| 172 | public function getPriority(): int |
||
| 173 | { |
||
| 174 | return (int)$this->priority; |
||
| 175 | } |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @param int $priority |
||
| 179 | * |
||
| 180 | * @return ItemPresetData |
||
| 181 | */ |
||
| 182 | public function setPriority(int $priority) |
||
| 183 | { |
||
| 184 | $this->priority = $priority; |
||
| 185 | |||
| 186 | return $this; |
||
| 187 | } |
||
| 188 | |||
| 189 | /** |
||
| 190 | * @return string |
||
| 191 | */ |
||
| 192 | public function getData() |
||
| 193 | { |
||
| 194 | return $this->data; |
||
| 195 | } |
||
| 196 | |||
| 197 | /** |
||
| 198 | * @param string $data |
||
| 199 | */ |
||
| 200 | public function setData(string $data) |
||
| 201 | { |
||
| 202 | $this->data = $data; |
||
| 203 | } |
||
| 204 | |||
| 205 | /** |
||
| 206 | * @return string |
||
| 207 | */ |
||
| 208 | public function getHash() |
||
| 209 | { |
||
| 210 | return sha1($this->type . (int)$this->userId . (int)$this->userGroupId . (int)$this->userProfileId . (int)$this->priority); |
||
| 211 | } |
||
| 212 | |||
| 213 | /** |
||
| 214 | * @return string |
||
| 215 | */ |
||
| 216 | public function getType() |
||
| 217 | { |
||
| 218 | return $this->type; |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @param string $type |
||
| 223 | */ |
||
| 224 | public function setType(string $type) |
||
| 225 | { |
||
| 226 | $this->type = $type; |
||
| 227 | } |
||
| 228 | } |