MediaWiki REL1_35
UserIdentityValue.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\User;
24
25use Wikimedia\Assert\Assert;
26
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}
Value object representing a user's identity.
__construct( $id, $name, $actor)
Stable to call.
Interface for objects representing user identity.