*/
private $name;
+ /**
+ * @var int
+ */
+ private $actor;
+
/**
* @param int $id
* @param string $name
+ * @param int $actor
*/
- public function __construct( $id, $name ) {
+ public function __construct( $id, $name, $actor ) {
Assert::parameterType( 'integer', $id, '$id' );
Assert::parameterType( 'string', $name, '$name' );
+ Assert::parameterType( 'integer', $actor, '$actor' );
$this->id = $id;
$this->name = $name;
+ $this->actor = $actor;
}
/**
return $this->name;
}
+ /**
+ * @return int The user's actor ID. May be 0 if no actor ID has been assigned.
+ */
+ public function getActorId() {
+ return $this->actor;
+ }
+
+ /**
+ * @since 1.32
+ *
+ * @param UserIdentity $user
+ * @return bool
+ */
+ public function equals( UserIdentity $user ) {
+ // XXX it's not clear whether central ID providers are supposed to obey this
+ return $this->getName() === $user->getName();
+ }
+
+ /**
+ * @since 1.34
+ *
+ * @return 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.
+ */
+ public function isRegistered() {
+ return $this->getId() != 0;
+ }
}