MediaWiki master
MediaWiki\User\UserIdentityValue Class Reference

Value object representing a user's identity. More...

Inherits MediaWiki\User\UserIdentity.

Collaboration diagram for MediaWiki\User\UserIdentityValue:

Public Member Functions

 __construct (int $id, string $name, $wikiId=self::LOCAL)
 
 __toString ()
 
 equals (?UserIdentity $user)
 
 getActorId ( $wikiId=self::LOCAL)
 
 getId ( $wikiId=self::LOCAL)
 The numerical user ID provided to the constructor.
 
 getName ()
 
 getWikiId ()
 Get the ID of the wiki this UserIdentity belongs to.
 
 isRegistered ()
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId().
 

Static Public Member Functions

static newAnonymous (string $name, $wikiId=self::LOCAL)
 Create UserIdentity for an anonymous user.
 
static newExternal (string $prefix, string $name, $wikiId=self::LOCAL)
 Create UserIdentity for an external user with $prefix and $name.
 
static newRegistered (int $userId, string $name, $wikiId=self::LOCAL)
 Create UserIdentity for a registered user.
 

Detailed Description

Value object representing a user's identity.

Stability: newable
Since
1.31

Definition at line 35 of file UserIdentityValue.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\UserIdentityValue::__construct ( int  $id,
string  $name,
  $wikiId = self::LOCAL 
)
Stability: stable
to call
Note
Signature in 1.35 was: ( $id, $name, $actor ).
Parameters
int$iduser ID
string$nameuser name
string | false$wikiIdwiki ID or self::LOCAL for the local wiki

Definition at line 60 of file UserIdentityValue.php.

Member Function Documentation

◆ __toString()

MediaWiki\User\UserIdentityValue::__toString ( )

Definition at line 176 of file UserIdentityValue.php.

◆ equals()

MediaWiki\User\UserIdentityValue::equals ( ?UserIdentity  $user)
Since
1.32
Parameters
UserIdentity | null$user
Returns
bool

Implements MediaWiki\User\UserIdentity.

Definition at line 157 of file UserIdentityValue.php.

◆ getActorId()

MediaWiki\User\UserIdentityValue::getActorId (   $wikiId = self::LOCAL)
Deprecated:
since 1.36, use ActorNormalization::acquireActorId instead.
Parameters
string | false$wikiId
Returns
int always 0.

Definition at line 146 of file UserIdentityValue.php.

◆ getId()

MediaWiki\User\UserIdentityValue::getId (   $wikiId = self::LOCAL)

The numerical user ID provided to the constructor.

Parameters
string | false$wikiIdThe wiki ID expected by the caller
Returns
int The user ID. May be 0 for anonymous users or for users with no local account.

Implements MediaWiki\User\UserIdentity.

Definition at line 127 of file UserIdentityValue.php.

◆ getName()

MediaWiki\User\UserIdentityValue::getName ( )
Returns
string The user's logical name. May be an IPv4 or IPv6 address for anonymous users.

Implements MediaWiki\User\UserIdentity.

Definition at line 135 of file UserIdentityValue.php.

◆ getWikiId()

MediaWiki\User\UserIdentityValue::getWikiId ( )

Get the ID of the wiki this UserIdentity belongs to.

Since
1.36
See also
RevisionRecord::getWikiId()
Returns
string|false The wiki's logical name or self::LOCAL to indicate the local wiki

Implements MediaWiki\DAO\WikiAwareEntity.

Definition at line 116 of file UserIdentityValue.php.

◆ isRegistered()

MediaWiki\User\UserIdentityValue::isRegistered ( )
Since
1.34
Returns
bool True if user is registered on this wiki, i.e., has a user ID. False if user is anonymous or has no local account (which can happen when importing). This is equivalent to getId() != 0 and is provided for code readability.

Implements MediaWiki\User\UserIdentity.

Definition at line 172 of file UserIdentityValue.php.

◆ newAnonymous()

static MediaWiki\User\UserIdentityValue::newAnonymous ( string  $name,
  $wikiId = self::LOCAL 
)
static

Create UserIdentity for an anonymous user.

Since
1.36
Parameters
string$name
string | false$wikiIdwiki ID or self::LOCAL for the local wiki
Returns
UserIdentityValue

Definition at line 76 of file UserIdentityValue.php.

◆ newExternal()

static MediaWiki\User\UserIdentityValue::newExternal ( string  $prefix,
string  $name,
  $wikiId = self::LOCAL 
)
static

Create UserIdentity for an external user with $prefix and $name.

Since
1.36
Parameters
string$prefix
string$name
string | false$wikiIdwiki ID or self::LOCAL for the local wiki
Returns
UserIdentityValue

Definition at line 103 of file UserIdentityValue.php.

◆ newRegistered()

static MediaWiki\User\UserIdentityValue::newRegistered ( int  $userId,
string  $name,
  $wikiId = self::LOCAL 
)
static

Create UserIdentity for a registered user.

Since
1.36
Parameters
int$userId
string$name
string | false$wikiIdwiki ID or self::LOCAL for the local wiki
Returns
UserIdentityValue

Definition at line 89 of file UserIdentityValue.php.


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