MediaWiki  master
MediaWiki\User\UserIdentityValue Class Reference

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

Inheritance diagram for MediaWiki\User\UserIdentityValue:
Collaboration diagram for MediaWiki\User\UserIdentityValue:

Public Member Functions

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

Private Attributes

int $actor
 
int $id
 
string $name
 
bool string $wikiId
 

Detailed Description

Value object representing a user's identity.

@newable

Since
1.31

Definition at line 37 of file UserIdentityValue.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 66 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\$actor, MediaWiki\User\UserIdentityValue\$id, MediaWiki\User\UserIdentityValue\$name, MediaWiki\User\UserIdentityValue\$wikiId, and MediaWiki\DAO\assertWikiIdParam().

Member Function Documentation

◆ __toString()

MediaWiki\User\UserIdentityValue::__toString ( )

Definition at line 162 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\getName().

◆ equals()

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

Implements MediaWiki\User\UserIdentity.

Definition at line 146 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentity\getName(), and MediaWiki\User\UserIdentityValue\getName().

◆ getActorId()

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

The numerical actor ID provided to the constructor or 0 if no actor ID has been assigned.

Deprecated:
since 1.36, use ActorNormalization::acquireActorId instead.
Parameters
string | false$wikiIdThe wiki ID expected by the caller. Omit if expecting the local wiki. Since 1.36.
Returns
int The user's actor ID. May be 0 if no actor ID has been assigned.

Implements MediaWiki\User\UserIdentity.

Definition at line 119 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\$actor, MediaWiki\User\UserIdentityValue\$wikiId, MediaWiki\DAO\deprecateInvalidCrossWiki(), and wfDeprecatedMsg().

◆ 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 97 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\$id, and MediaWiki\DAO\deprecateInvalidCrossWiki().

Referenced by MediaWiki\User\UserIdentityValue\isRegistered().

◆ 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 105 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\$name.

Referenced by MediaWiki\User\UserIdentityValue\__toString(), and MediaWiki\User\UserIdentityValue\equals().

◆ 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 86 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\$wikiId.

◆ 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 158 of file UserIdentityValue.php.

References MediaWiki\User\UserIdentityValue\getId().

◆ setActorId()

MediaWiki\User\UserIdentityValue::setActorId ( int  $actorId)

Sets the actor id.

This method is deprecated upon introduction. It only exists for transition to ActorStore, and will be removed shortly - T274148

Access: internal
Deprecated:
since 1.36
Parameters
int$actorId

Definition at line 176 of file UserIdentityValue.php.

Member Data Documentation

◆ $actor

int MediaWiki\User\UserIdentityValue::$actor
private

◆ $id

int MediaWiki\User\UserIdentityValue::$id
private

◆ $name

string MediaWiki\User\UserIdentityValue::$name
private

◆ $wikiId

bool string MediaWiki\User\UserIdentityValue::$wikiId
private

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