MediaWiki  1.34.0
UserIdentityValue.php
Go to the documentation of this file.
1 <?php
23 namespace MediaWiki\User;
24 
25 use Wikimedia\Assert\Assert;
26 
32 class UserIdentityValue implements UserIdentity {
33 
37  private $id;
38 
42  private $name;
43 
47  private $actor;
48 
54  public function __construct( $id, $name, $actor ) {
55  Assert::parameterType( 'integer', $id, '$id' );
56  Assert::parameterType( 'string', $name, '$name' );
57  Assert::parameterType( 'integer', $actor, '$actor' );
58 
59  $this->id = $id;
60  $this->name = $name;
61  $this->actor = $actor;
62  }
63 
67  public function getId() {
68  return $this->id;
69  }
70 
74  public function getName() {
75  return $this->name;
76  }
77 
81  public function getActorId() {
82  return $this->actor;
83  }
84 
91  public function equals( UserIdentity $user ) {
92  // XXX it's not clear whether central ID providers are supposed to obey this
93  return $this->getName() === $user->getName();
94  }
95 
103  public function isRegistered() {
104  return $this->getId() != 0;
105  }
106 }
MediaWiki\User\UserIdentityValue
Value object representing a user's identity.
Definition: UserIdentityValue.php:32
MediaWiki\User\UserIdentityValue\getId
getId()
Definition: UserIdentityValue.php:67
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:32
MediaWiki\User\UserIdentityValue\getActorId
getActorId()
Definition: UserIdentityValue.php:81
MediaWiki\User\UserIdentity\getName
getName()
MediaWiki\User\UserIdentityValue\$name
string $name
Definition: UserIdentityValue.php:42
MediaWiki\User\UserIdentityValue\__construct
__construct( $id, $name, $actor)
Definition: UserIdentityValue.php:54
MediaWiki\User
Definition: UserIdentity.php:23
MediaWiki\User\UserIdentityValue\$actor
int $actor
Definition: UserIdentityValue.php:47
MediaWiki\User\UserIdentityValue\getName
getName()
Definition: UserIdentityValue.php:74
MediaWiki\User\UserIdentityValue\isRegistered
isRegistered()
Definition: UserIdentityValue.php:103
MediaWiki\User\UserIdentityValue\equals
equals(UserIdentity $user)
Definition: UserIdentityValue.php:91
MediaWiki\User\UserIdentityValue\$id
int $id
Definition: UserIdentityValue.php:37