MediaWiki  master
UserIdentityValue.php
Go to the documentation of this file.
1 <?php
23 namespace MediaWiki\User;
24 
25 use Wikimedia\Assert\Assert;
26 
34 class UserIdentityValue implements UserIdentity {
35 
39  private $id;
40 
44  private $name;
45 
49  private $actor;
50 
58  public function __construct( $id, $name, $actor ) {
59  Assert::parameterType( 'integer', $id, '$id' );
60  Assert::parameterType( 'string', $name, '$name' );
61  Assert::parameterType( 'integer', $actor, '$actor' );
62 
63  $this->id = $id;
64  $this->name = $name;
65  $this->actor = $actor;
66  }
67 
71  public function getId() {
72  return $this->id;
73  }
74 
78  public function getName() {
79  return $this->name;
80  }
81 
85  public function getActorId() {
86  return $this->actor;
87  }
88 
95  public function equals( UserIdentity $user ) {
96  // XXX it's not clear whether central ID providers are supposed to obey this
97  return $this->getName() === $user->getName();
98  }
99 
107  public function isRegistered() {
108  return $this->getId() != 0;
109  }
110 }
MediaWiki\User\UserIdentityValue
Value object representing a user's identity.
Definition: UserIdentityValue.php:34
MediaWiki\User\UserIdentityValue\getId
getId()
Definition: UserIdentityValue.php:71
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:32
MediaWiki\User\UserIdentityValue\getActorId
getActorId()
Definition: UserIdentityValue.php:85
MediaWiki\User\UserIdentity\getName
getName()
MediaWiki\User\UserIdentityValue\$name
string $name
Definition: UserIdentityValue.php:44
MediaWiki\User\UserIdentityValue\__construct
__construct( $id, $name, $actor)
Stable to call.
Definition: UserIdentityValue.php:58
MediaWiki\User
Definition: DefaultOptionsLookup.php:21
MediaWiki\User\UserIdentityValue\$actor
int $actor
Definition: UserIdentityValue.php:49
MediaWiki\User\UserIdentityValue\getName
getName()
Definition: UserIdentityValue.php:78
MediaWiki\User\UserIdentityValue\isRegistered
isRegistered()
Definition: UserIdentityValue.php:107
MediaWiki\User\UserIdentityValue\equals
equals(UserIdentity $user)
Definition: UserIdentityValue.php:95
MediaWiki\User\UserIdentityValue\$id
int $id
Definition: UserIdentityValue.php:39