55 private $verified =
false;
60 private function __construct( ?
User $user, $verified ) {
62 if ( $user && $user->
isAnon() && !$userNameUtils->isUsable( $user->
getName() ) ) {
79 return new self(
null,
true );
88 public static function newFromId( $id, $verified =
false ) {
94 throw new \InvalidArgumentException(
'Invalid ID' );
97 return new self( $user, $verified );
109 UserRigorOptions::RIGOR_USABLE
112 throw new \InvalidArgumentException(
'Invalid user name' );
114 return new self( $user, $verified );
124 return new self( $user, $verified );
132 return $this->user ===
null;
140 return $this->verified;
149 return $this->user ===
null ? 0 : $this->user->getId();
157 return $this->user ===
null ? null : $this->user->getName();
165 return $this->user ===
null || $this->user->getId() === 0 ?
'' : $this->user->getToken(
false );
173 return $this->user ??
new User;
181 return $this->
verified ? $this :
new self( $this->user,
true );
185 if ( $this->user ===
null ) {
189 ( $this->
verified ?
'+' :
'-' ) .
':' .
getName()
Get the user name, or the IP of an anonymous user.
static newFromName( $name, $validate='valid')
static newFromId( $id)
Static factory method for creation from a given user ID.
load( $flags=self::READ_NORMAL)
Load the user table data for this object from the source given by mFrom.
isAnon()
Get whether the user is anonymous.