WatchedItem.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. use MediaWiki\Linker\LinkTarget;
  22. /**
  23. * Representation of a pair of user and title for watchlist entries.
  24. *
  25. * @author Tim Starling
  26. * @author Addshore
  27. *
  28. * @ingroup Watchlist
  29. */
  30. class WatchedItem {
  31. /**
  32. * @var LinkTarget
  33. */
  34. private $linkTarget;
  35. /**
  36. * @var User
  37. */
  38. private $user;
  39. /**
  40. * @var null|string the value of the wl_notificationtimestamp field
  41. */
  42. private $notificationTimestamp;
  43. /**
  44. * @param User $user
  45. * @param LinkTarget $linkTarget
  46. * @param null|string $notificationTimestamp the value of the wl_notificationtimestamp field
  47. */
  48. public function __construct(
  49. User $user,
  50. LinkTarget $linkTarget,
  51. $notificationTimestamp
  52. ) {
  53. $this->user = $user;
  54. $this->linkTarget = $linkTarget;
  55. $this->notificationTimestamp = $notificationTimestamp;
  56. }
  57. /**
  58. * @return User
  59. */
  60. public function getUser() {
  61. return $this->user;
  62. }
  63. /**
  64. * @return LinkTarget
  65. */
  66. public function getLinkTarget() {
  67. return $this->linkTarget;
  68. }
  69. /**
  70. * Get the notification timestamp of this entry.
  71. *
  72. * @return bool|null|string
  73. */
  74. public function getNotificationTimestamp() {
  75. return $this->notificationTimestamp;
  76. }
  77. }