Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5984325
RateLimitSubject.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
RateLimitSubject.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
namespace
MediaWiki\Permissions
;
use
MediaWiki\User\UserIdentity
;
/**
* Represents the subject that rate limits are applied to.
*
* @unstable
* @since 1.39
*/
class
RateLimitSubject
{
/**
* @var UserIdentity
*/
private
$user
;
/**
* @var string|null
*/
private
$ip
;
/**
* @var array
*/
private
$flags
;
/** @var string Flag indicating the user is exempt from rate limits */
public
const
EXEMPT
=
'exempt'
;
/** @var string Flag indicating the user is a newbie */
public
const
NEWBIE
=
'newbie'
;
/**
* @internal
*
* @param UserIdentity $user
* @param string|null $ip
* @param array<string,bool> $flags
*/
public
function
__construct
(
UserIdentity
$user
,
?
string
$ip
,
array
$flags
)
{
$this
->
user
=
$user
;
$this
->
ip
=
$ip
;
$this
->
flags
=
$flags
;
}
public
function
getUser
():
UserIdentity
{
return
$this
->
user
;
}
public
function
getIP
():
?
string
{
return
$this
->
ip
;
}
/**
* Checks whether the given flag applies.
*
* @param string $flag
*
* @return bool
*/
public
function
is
(
string
$flag
)
{
return
!
empty
(
$this
->
flags
[
$flag
]
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 23:17 (2 w, 18 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
52/b1/86448541acc8f407e1c6d2de3e20
Default Alt Text
RateLimitSubject.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment