26use InvalidArgumentException;
57 private $verified =
false;
62 private function __construct( ?
User $user, $verified ) {
64 if ( $user && $user->
isAnon() && !$userNameUtils->isUsable( $user->
getName() ) ) {
81 return new self(
null, true );
90 public static function newFromId( $id, $verified =
false ) {
96 throw new InvalidArgumentException(
'Invalid ID' );
99 return new self( $user, $verified );
111 UserRigorOptions::RIGOR_USABLE
114 throw new InvalidArgumentException(
'Invalid user name' );
116 return new self( $user, $verified );
126 return new self( $user, $verified );
134 return $this->user ===
null;
142 return $this->verified;
151 return $this->user ===
null ? 0 : $this->user->getId();
159 return $this->user ===
null ? null : $this->user->getName();
167 return $this->user ===
null || $this->user->getId() === 0 ?
'' : $this->user->getToken(
false );
183 return $this->
verified ? $this :
new self( $this->user, true );
187 if ( $this->user ===
null ) {
191 ( $this->
verified ?
'+' :
'-' ) .
':' .