MediaWiki  master
MediaWiki\User\UserFactory Class Reference

Creates User objects. More...

Inheritance diagram for MediaWiki\User\UserFactory:
Collaboration diagram for MediaWiki\User\UserFactory:

Public Member Functions

 __construct (UserNameUtils $userNameUtils)
 
 newAnonymous ( $ip=null)
 Returns a new anonymous User based on ip. More...
 
 newFromActorId (int $actorId)
 
 newFromAnyId (?int $userId, ?string $userName, ?int $actorId, $dbDomain=false)
 
 newFromConfirmationCode (string $confirmationCode, int $flags=self::READ_NORMAL)
 
 newFromId (int $id)
 
 newFromName (string $name, string $validate=UserNameUtils::RIGOR_VALID)
 
 newFromUserIdentity (UserIdentity $userIdentity)
 

Private Attributes

UserNameUtils $userNameUtils
 

Additional Inherited Members

- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS) More...
 

Detailed Description

Creates User objects.

For now, there is nothing much interesting in this class. It was meant for preventing static User methods causing problems in unit tests.

Since
1.35

Definition at line 36 of file UserFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\UserFactory::__construct ( UserNameUtils  $userNameUtils)
Parameters
UserNameUtils$userNameUtils

Definition at line 46 of file UserFactory.php.

References MediaWiki\User\UserFactory\$userNameUtils.

Member Function Documentation

◆ newAnonymous()

MediaWiki\User\UserFactory::newAnonymous (   $ip = null)

Returns a new anonymous User based on ip.

Since
1.35
Parameters
string | null$ipIP address
Returns
User

Definition at line 75 of file UserFactory.php.

References User\isIP(), MediaWiki\User\UserFactory\newFromName(), and MediaWiki\User\UserNameUtils\RIGOR_NONE.

◆ newFromActorId()

MediaWiki\User\UserFactory::newFromActorId ( int  $actorId)
See also
User::newFromActorId
Since
1.35
Parameters
int$actorId
Returns
User

Definition at line 109 of file UserFactory.php.

References User\newFromActorId().

◆ newFromAnyId()

MediaWiki\User\UserFactory::newFromAnyId ( ?int  $userId,
?string  $userName,
?int  $actorId,
  $dbDomain = false 
)
See also
User::newFromAnyId
Since
1.35
Parameters
?int$userId
?string$userName
?int$actorId
bool | string$dbDomain
Returns
User

Definition at line 144 of file UserFactory.php.

References User\newFromAnyId().

Referenced by MediaWiki\User\UserFactory\newFromUserIdentity().

◆ newFromConfirmationCode()

MediaWiki\User\UserFactory::newFromConfirmationCode ( string  $confirmationCode,
int  $flags = self::READ_NORMAL 
)
See also
User::newFromConfirmationCode
Since
1.35
Parameters
string$confirmationCode
int$flags
Returns
User|null

Definition at line 162 of file UserFactory.php.

References User\newFromConfirmationCode().

◆ newFromId()

MediaWiki\User\UserFactory::newFromId ( int  $id)
See also
User::newFromId
Since
1.35
Parameters
int$id
Returns
User

Definition at line 97 of file UserFactory.php.

References User\newFromId().

◆ newFromName()

MediaWiki\User\UserFactory::newFromName ( string  $name,
string  $validate = UserNameUtils::RIGOR_VALID 
)
See also
User::newFromName
Since
1.35
Parameters
string$name
string$validateValidation strategy, one of the UserNameUtils::RIGOR_* constants. For no validation, use UserNameUtils::RIGOR_NONE.
Returns
User|bool

Definition at line 60 of file UserFactory.php.

References User\newFromName().

Referenced by MediaWiki\User\UserFactory\newAnonymous().

◆ newFromUserIdentity()

MediaWiki\User\UserFactory::newFromUserIdentity ( UserIdentity  $userIdentity)

Member Data Documentation

◆ $userNameUtils

UserNameUtils MediaWiki\User\UserFactory::$userNameUtils
private

Definition at line 41 of file UserFactory.php.

Referenced by MediaWiki\User\UserFactory\__construct().


The documentation for this class was generated from the following file: