Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1429045
UserIdentityUtils.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
UserIdentityUtils.php
View Options
<?php
namespace
MediaWiki\User
;
use
MediaWiki\User\TempUser\TempUserConfig
;
/**
* Convenience functions for interpreting UserIdentity objects using additional
* services or config.
*
* @since 1.41
*/
class
UserIdentityUtils
{
private
TempUserConfig
$tempUserConfig
;
/**
* @internal
*
* @param TempUserConfig $tempUserConfig
*/
public
function
__construct
(
TempUserConfig
$tempUserConfig
)
{
$this
->
tempUserConfig
=
$tempUserConfig
;
}
/**
* Is the user a temporary user?
*
* @param UserIdentity $user
* @return bool
*/
public
function
isTemp
(
UserIdentity
$user
)
{
return
$this
->
tempUserConfig
->
isTempName
(
$user
->
getName
()
);
}
/**
* Is the user a normal non-temporary registered user?
*
* @param UserIdentity $user
* @return bool
*/
public
function
isNamed
(
UserIdentity
$user
)
{
return
$user
->
isRegistered
()
&&
!
$this
->
tempUserConfig
->
isTempName
(
$user
->
getName
()
);
}
/**
* Get user identity type, used for internal logic like tracking statistics per account type.
* Only for internal use like tracking statistics and meet DRY
*
* @internal
* @param UserIdentity $user
* @return string
*/
public
function
getShortUserTypeInternal
(
UserIdentity
$user
):
string
{
if
(
!
$user
->
isRegistered
()
)
{
return
'anon'
;
}
return
$this
->
isTemp
(
$user
)
?
'temp'
:
'named'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 16:59 (10 h, 40 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
54/b6/81580418390fdb47b28488ea51be
Default Alt Text
UserIdentityUtils.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment