MediaWiki  master
WatchedItem Class Reference

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

Collaboration diagram for WatchedItem:

Public Member Functions

 __construct (UserIdentity $user, LinkTarget $linkTarget, $notificationTimestamp, ?string $expiry=null)
 
 getExpiry ()
 When the watched item will expire. More...
 
 getExpiryInDays ()
 Get days remaining until a watched item expires. More...
 
 getLinkTarget ()
 
 getNotificationTimestamp ()
 Get the notification timestamp of this entry. More...
 
 getUser ()
 
 getUserIdentity ()
 
 isExpired ()
 Has the watched item expired? More...
 

Static Public Member Functions

static newFromRecentChange (RecentChange $recentChange, UserIdentity $user)
 

Private Attributes

string null $expiry
 When to automatically unwatch the page. More...
 
LinkTarget $linkTarget
 
null string $notificationTimestamp
 the value of the wl_notificationtimestamp field More...
 
UserIdentity $user
 
const SECONDS_IN_A_DAY = 86400
 Used to calculate how many days are remaining until a watched item will expire. More...
 

Detailed Description

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

Author
Tim Starling
Addshore

Definition at line 33 of file WatchedItem.php.

Constructor & Destructor Documentation

◆ __construct()

WatchedItem::__construct ( UserIdentity  $user,
LinkTarget  $linkTarget,
  $notificationTimestamp,
?string  $expiry = null 
)
Parameters
UserIdentity$user
LinkTarget$linkTarget
null | string$notificationTimestampthe value of the wl_notificationtimestamp field
null | string$expiryOptional expiry timestamp in any format acceptable to wfTimestamp()

Definition at line 69 of file WatchedItem.php.

References $expiry, $linkTarget, $notificationTimestamp, and $user.

Member Function Documentation

◆ getExpiry()

WatchedItem::getExpiry ( )

When the watched item will expire.

Since
1.35
Returns
string|null null or in a format acceptable to wfTimestamp().

Definition at line 134 of file WatchedItem.php.

References $expiry.

Referenced by getExpiryInDays(), WatchAction\getExpiryOptions(), isExpired(), and Linker\tooltipAndAccesskeyAttribs().

◆ getExpiryInDays()

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 161 of file WatchedItem.php.

References getExpiry(), SECONDS_IN_A_DAY, and wfTimestamp().

Referenced by WatchAction\getExpiryOptions().

◆ getLinkTarget()

WatchedItem::getLinkTarget ( )
Returns
LinkTarget

Definition at line 114 of file WatchedItem.php.

References $linkTarget.

Referenced by WatchedItemStore\cache(), ApiQueryWatchlist\extractOutputData(), and ApiQueryWatchlist\run().

◆ getNotificationTimestamp()

WatchedItem::getNotificationTimestamp ( )

Get the notification timestamp of this entry.

Returns
bool|null|string

Definition at line 123 of file WatchedItem.php.

References $notificationTimestamp.

Referenced by ApiQueryWatchlist\extractOutputData().

◆ getUser()

WatchedItem::getUser ( )
Deprecated:
since 1.34, use getUserIdentity()
Returns
User

Definition at line 100 of file WatchedItem.php.

References User\newFromIdentity().

◆ getUserIdentity()

WatchedItem::getUserIdentity ( )
Returns
UserIdentity

Definition at line 107 of file WatchedItem.php.

References $user.

Referenced by WatchedItemStore\cache().

◆ isExpired()

WatchedItem::isExpired ( )

Has the watched item expired?

Since
1.35
Returns
bool

Definition at line 145 of file WatchedItem.php.

References getExpiry(), and wfTimestamp().

◆ newFromRecentChange()

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

Definition at line 87 of file WatchedItem.php.

References $user, and RecentChange\getTitle().

Referenced by ChangesList\getWatchlistExpiry().

Member Data Documentation

◆ $expiry

string null WatchedItem::$expiry
private

When to automatically unwatch the page.

Definition at line 52 of file WatchedItem.php.

Referenced by __construct(), and getExpiry().

◆ $linkTarget

LinkTarget WatchedItem::$linkTarget
private

Definition at line 37 of file WatchedItem.php.

Referenced by __construct(), and getLinkTarget().

◆ $notificationTimestamp

null string WatchedItem::$notificationTimestamp
private

the value of the wl_notificationtimestamp field

Definition at line 47 of file WatchedItem.php.

Referenced by __construct(), and getNotificationTimestamp().

◆ $user

UserIdentity WatchedItem::$user
private

Definition at line 42 of file WatchedItem.php.

Referenced by __construct(), getUserIdentity(), and newFromRecentChange().

◆ SECONDS_IN_A_DAY

const WatchedItem::SECONDS_IN_A_DAY = 86400
private

Used to calculate how many days are remaining until a watched item will expire.

Uses a different algorithm from Language::getDurationIntervals for calculating days remaining in an interval of time

Since
1.35

Definition at line 61 of file WatchedItem.php.

Referenced by getExpiryInDays().


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