Merge "HTML escape parameter 'text' of hook 'SkinEditSectionLinks'"
[lhc/web/wiklou.git] / includes / watcheditem / WatchedItem.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @ingroup Watchlist
20 */
21
22 use MediaWiki\Linker\LinkTarget;
23 use MediaWiki\User\UserIdentity;
24
25 /**
26 * Representation of a pair of user and title for watchlist entries.
27 *
28 * @author Tim Starling
29 * @author Addshore
30 *
31 * @ingroup Watchlist
32 */
33 class WatchedItem {
34 /**
35 * @var LinkTarget
36 */
37 private $linkTarget;
38
39 /**
40 * @var UserIdentity
41 */
42 private $user;
43
44 /**
45 * @var null|string the value of the wl_notificationtimestamp field
46 */
47 private $notificationTimestamp;
48
49 /**
50 * @param UserIdentity $user
51 * @param LinkTarget $linkTarget
52 * @param null|string $notificationTimestamp the value of the wl_notificationtimestamp field
53 */
54 public function __construct(
55 UserIdentity $user,
56 LinkTarget $linkTarget,
57 $notificationTimestamp
58 ) {
59 $this->user = $user;
60 $this->linkTarget = $linkTarget;
61 $this->notificationTimestamp = $notificationTimestamp;
62 }
63
64 /**
65 * @deprecated since 1.34, use getUserIdentity()
66 * @return User
67 */
68 public function getUser() {
69 return User::newFromIdentity( $this->user );
70 }
71
72 /**
73 * @return UserIdentity
74 */
75 public function getUserIdentity() {
76 return $this->user;
77 }
78
79 /**
80 * @return LinkTarget
81 */
82 public function getLinkTarget() {
83 return $this->linkTarget;
84 }
85
86 /**
87 * Get the notification timestamp of this entry.
88 *
89 * @return bool|null|string
90 */
91 public function getNotificationTimestamp() {
92 return $this->notificationTimestamp;
93 }
94 }