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 UserPassRecoverData |
||
29 | * |
||
30 | * @package SP\DataModel |
||
31 | */ |
||
32 | class UserPassRecoverData extends DataModelBase |
||
33 | { |
||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | public $userId = 0; |
||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | public $hash = ''; |
||
42 | /** |
||
43 | * @var int |
||
44 | */ |
||
45 | public $date = 0; |
||
46 | /** |
||
47 | * @var bool |
||
48 | */ |
||
49 | public $used = 0; |
||
50 | |||
51 | /** |
||
52 | * @return int |
||
53 | */ |
||
54 | public function getUserId() |
||
55 | { |
||
56 | return (int)$this->userId; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param int $userId |
||
61 | */ |
||
62 | public function setUserId($userId) |
||
63 | { |
||
64 | $this->userId = (int)$userId; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getHash() |
||
71 | { |
||
72 | return $this->hash; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @param string $hash |
||
77 | */ |
||
78 | public function setHash($hash) |
||
79 | { |
||
80 | $this->hash = $hash; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return int |
||
85 | */ |
||
86 | public function getDate() |
||
87 | { |
||
88 | return $this->date; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @param int $date |
||
93 | */ |
||
94 | public function setDate($date) |
||
95 | { |
||
96 | $this->date = $date; |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @return boolean |
||
101 | */ |
||
102 | public function isUsed() |
||
103 | { |
||
104 | return (int)$this->used; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @param boolean $used |
||
109 | */ |
||
110 | public function setUsed($used) |
||
111 | { |
||
112 | $this->used = (int)$used; |
||
0 ignored issues
–
show
The property
$used was declared of type boolean , but (int)$used is of type integer . Maybe add a type cast?
This check looks for assignments to scalar types that may be of the wrong type. To ensure the code behaves as expected, it may be a good idea to add an explicit type cast. $answer = 42;
$correct = false;
$correct = (bool) $answer;
![]() |
|||
113 | } |
||
114 | |||
115 | } |