1 | <?php |
||
46 | class User extends DomainObjectAbstract |
||
47 | { |
||
48 | /** |
||
49 | * @var string User name. |
||
50 | */ |
||
51 | public $name; |
||
52 | |||
53 | /** |
||
54 | * @var string User description. |
||
55 | */ |
||
56 | public $description; |
||
57 | |||
58 | /** |
||
59 | * @var string User e-mail. |
||
60 | */ |
||
61 | public $email; |
||
62 | |||
63 | /** |
||
64 | * @var string User hashed password. |
||
65 | */ |
||
66 | public $password; |
||
67 | |||
68 | /** |
||
69 | * @var int It say if user is active or not. |
||
70 | */ |
||
71 | public $active = 0; |
||
72 | |||
73 | /** |
||
74 | * @var string User creation date. |
||
75 | */ |
||
76 | public $created; |
||
77 | |||
78 | /** |
||
79 | * @var string Last update. |
||
80 | */ |
||
81 | public $lastUpdate; |
||
82 | |||
83 | /** |
||
84 | * @var object Password class for manage password. |
||
85 | */ |
||
86 | private $passwordUtility; |
||
87 | |||
88 | /** |
||
89 | * Class Constructor. |
||
90 | * |
||
91 | * <pre><code class="php">$password = new Password(); |
||
92 | * |
||
93 | * $user = new User($password); |
||
94 | * </code></pre> |
||
95 | * |
||
96 | * @param Password $password |
||
97 | */ |
||
98 | 15 | public function __construct(Password $password) |
|
107 | |||
108 | /** |
||
109 | * Set new user password without do any check. |
||
110 | * |
||
111 | * <pre><code class="php">$password = new Password(); |
||
112 | * |
||
113 | * $user = new User($password); |
||
114 | * |
||
115 | * $user->setPassword('newPassword'); |
||
116 | * </code></pre> |
||
117 | * |
||
118 | * @param string $newPassword |
||
119 | */ |
||
120 | 2 | public function setPassword(string $newPassword) |
|
125 | |||
126 | /** |
||
127 | * Change user password only after check old password. |
||
128 | * |
||
129 | * <pre><code class="php">$password = new Password(); |
||
130 | * |
||
131 | * $user = new User($password); |
||
132 | * |
||
133 | * $user->chagePassword('newPassword', 'oldPassword'); |
||
134 | * </code></pre> |
||
135 | * |
||
136 | * @param string $newPassword |
||
137 | * @param string $oldPassword |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | 1 | public function chagePassword(string $newPassword, string $oldPassword) : bool |
|
154 | } |
||
155 |