MediaWiki REL1_37
MediaWiki\Block\BlockUtils Class Reference

Backend class for blocking utils. More...

Collaboration diagram for MediaWiki\Block\BlockUtils:

Public Member Functions

 __construct (ServiceOptions $options, UserIdentityLookup $userIdentityLookup, UserNameUtils $userNameUtils)
 
 parseBlockTarget ( $target)
 From an existing block, get the target and the type of target.
 
 validateTarget ( $value)
 Validate block target.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Member Functions

 validateIPv4Range (int $range)
 Validate an IPv4 range.
 
 validateIPv6Range (int $range)
 Validate an IPv6 range.
 

Private Attributes

ServiceOptions $options
 
UserIdentityLookup $userIdentityLookup
 
UserNameUtils $userNameUtils
 

Detailed Description

Backend class for blocking utils.

This service should contain any methods that are useful to more than one blocking-related class and doesn't fit any other service.

For now, this includes only

  • block target parsing
  • block target validation
Since
1.36

Definition at line 45 of file BlockUtils.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\BlockUtils::__construct ( ServiceOptions  $options,
UserIdentityLookup  $userIdentityLookup,
UserNameUtils  $userNameUtils 
)
Parameters
ServiceOptions$options
UserIdentityLookup$userIdentityLookup
UserNameUtils$userNameUtils

Definition at line 67 of file BlockUtils.php.

References MediaWiki\Block\BlockUtils\$options, MediaWiki\Block\BlockUtils\$userIdentityLookup, MediaWiki\Block\BlockUtils\$userNameUtils, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ parseBlockTarget()

MediaWiki\Block\BlockUtils::parseBlockTarget (   $target)

From an existing block, get the target and the type of target.

Note that, except for null, it is always safe to treat the target as a string; for UserIdentityValue objects this will return UserIdentityValue::__toString() which in turn gives UserIdentityValue::getName().

If the type is not null, it will be an AbstractBlock::TYPE_ constant.

Parameters
string | UserIdentity | null$target
Returns
array [ UserIdentity|String|null, int|null ]

Definition at line 91 of file BlockUtils.php.

References MediaWiki\Block\Block\TYPE_IP, and MediaWiki\Block\Block\TYPE_USER.

Referenced by MediaWiki\Block\BlockPermissionChecker\__construct(), and SpecialBlock\processFormInternal().

◆ validateIPv4Range()

MediaWiki\Block\BlockUtils::validateIPv4Range ( int  $range)
private

Validate an IPv4 range.

Parameters
int$range
Returns
Status

Definition at line 202 of file BlockUtils.php.

References StatusValue\fatal().

◆ validateIPv6Range()

MediaWiki\Block\BlockUtils::validateIPv6Range ( int  $range)
private

Validate an IPv6 range.

Parameters
int$range
Returns
Status

Definition at line 226 of file BlockUtils.php.

References StatusValue\fatal().

◆ validateTarget()

MediaWiki\Block\BlockUtils::validateTarget (   $value)

Validate block target.

Parameters
string | UserIdentity$value
Returns
Status

Definition at line 155 of file BlockUtils.php.

Member Data Documentation

◆ $options

ServiceOptions MediaWiki\Block\BlockUtils::$options
private

Definition at line 47 of file BlockUtils.php.

Referenced by MediaWiki\Block\BlockUtils\__construct().

◆ $userIdentityLookup

UserIdentityLookup MediaWiki\Block\BlockUtils::$userIdentityLookup
private

Definition at line 50 of file BlockUtils.php.

Referenced by MediaWiki\Block\BlockUtils\__construct().

◆ $userNameUtils

UserNameUtils MediaWiki\Block\BlockUtils::$userNameUtils
private

Definition at line 53 of file BlockUtils.php.

Referenced by MediaWiki\Block\BlockUtils\__construct().

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\BlockUtils::CONSTRUCTOR_OPTIONS
Initial value:
= [
'BlockCIDRLimit',
]
Access: internal
Only for use by ServiceWiring

Definition at line 58 of file BlockUtils.php.


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