MediaWiki master
MediaWiki\Watchlist\WatchedItem Class Reference

Representation of a pair of user and title for watchlist entries. More...

Public Member Functions

 __construct (UserIdentity $user, $target, $notificationTimestamp, ?string $expiry=null)
 
 getExpiry (?int $style=TS_MW)
 When the watched item will expire.
 
 getExpiryInDays ()
 Get days remaining until a watched item expires.
 
 getExpiryInDaysText (MessageLocalizer $msgLocalizer, $isDropdownOption=false)
 Get days remaining until a watched item expires as a text.
 
 getLinkTarget ()
 
 getNotificationTimestamp ()
 Get the notification timestamp of this entry.
 
 getTarget ()
 
 getUserIdentity ()
 
 isExpired ()
 Has the watched item expired?
 

Static Public Member Functions

static calculateExpiryInDays (?string $expiry)
 Get the number of days remaining until the given expiry time.
 
static newFromRecentChange (RecentChange $recentChange, UserIdentity $user)
 

Detailed Description

Representation of a pair of user and title for watchlist entries.

Author
Tim Starling
Addshore

Definition at line 42 of file WatchedItem.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Watchlist\WatchedItem::__construct ( UserIdentity $user,
$target,
$notificationTimestamp,
?string $expiry = null )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
bool | null | string$notificationTimestampthe value of the wl_notificationtimestamp field
null | string$expiryOptional expiry timestamp in any format acceptable to wfTimestamp()

Definition at line 79 of file WatchedItem.php.

Member Function Documentation

◆ calculateExpiryInDays()

static MediaWiki\Watchlist\WatchedItem::calculateExpiryInDays ( ?string $expiry)
static

Get the number of days remaining until the given expiry time.

Since
1.35
Parameters
string | null$expiryThe expiry to calculate from, in any format supported by MWTimestamp::convert().
Returns
int|null The remaining number of days or null if $expiry is null.

Definition at line 198 of file WatchedItem.php.

◆ getExpiry()

MediaWiki\Watchlist\WatchedItem::getExpiry ( ?int $style = TS_MW)

When the watched item will expire.

Since
1.35
Parameters
int | null$styleGiven timestamp format to style the ConvertibleTimestamp
Returns
string|null null or in a format acceptable to ConvertibleTimestamp (TS_* constants). Default is TS_MW format.

Definition at line 156 of file WatchedItem.php.

Referenced by WatchAction\getExpiryOptions(), and MediaWiki\Specials\SpecialWatchlist\outputChangesList().

◆ getExpiryInDays()

MediaWiki\Watchlist\WatchedItem::getExpiryInDays ( )

Get days remaining until a watched item expires.

Since
1.35
Returns
int|null days remaining or null if no expiration is present

Definition at line 184 of file WatchedItem.php.

◆ getExpiryInDaysText()

MediaWiki\Watchlist\WatchedItem::getExpiryInDaysText ( MessageLocalizer $msgLocalizer,
$isDropdownOption = false )

Get days remaining until a watched item expires as a text.

Since
1.35
Parameters
MessageLocalizer$msgLocalizer
bool$isDropdownOptionWhether the text is being displayed as a dropdown option. The text is different as a dropdown option from when it is used in other places as a watchlist indicator.
Returns
string days remaining text and '' if no expiration is present

Definition at line 224 of file WatchedItem.php.

Referenced by WatchAction\getExpiryOptions().

◆ getLinkTarget()

MediaWiki\Watchlist\WatchedItem::getLinkTarget ( )
Returns
LinkTarget
Deprecated
since 1.36, use getTarget() instead

Definition at line 124 of file WatchedItem.php.

References MediaWiki\Watchlist\WatchedItem\getTarget().

◆ getNotificationTimestamp()

MediaWiki\Watchlist\WatchedItem::getNotificationTimestamp ( )

Get the notification timestamp of this entry.

Returns
bool|null|string

Definition at line 144 of file WatchedItem.php.

◆ getTarget()

MediaWiki\Watchlist\WatchedItem::getTarget ( )
Returns
LinkTarget|PageIdentity deprecated returning LinkTarget since 1.36
Since
1.36

Definition at line 135 of file WatchedItem.php.

Referenced by MediaWiki\Watchlist\WatchedItem\getLinkTarget().

◆ getUserIdentity()

MediaWiki\Watchlist\WatchedItem::getUserIdentity ( )
Returns
UserIdentity

Definition at line 116 of file WatchedItem.php.

◆ isExpired()

MediaWiki\Watchlist\WatchedItem::isExpired ( )

Has the watched item expired?

Since
1.35
Returns
bool

Definition at line 169 of file WatchedItem.php.

◆ newFromRecentChange()

static MediaWiki\Watchlist\WatchedItem::newFromRecentChange ( RecentChange $recentChange,
UserIdentity $user )
static
Since
1.35
Parameters
RecentChange$recentChange
UserIdentity$user
Returns
WatchedItem

Definition at line 104 of file WatchedItem.php.

References RecentChange\getTitle().


The documentation for this class was generated from the following file: