MediaWiki REL1_39
MediaWiki\Block\BlockUtils Class Reference

Backend class for blocking utils. More...

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
 

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 46 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 68 of file BlockUtils.php.

References 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 92 of file BlockUtils.php.

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

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

◆ validateTarget()

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

Validate block target.

Parameters
string | UserIdentity$value
Returns
Status

Definition at line 156 of file BlockUtils.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\BlockUtils::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const BlockCIDRLimit
Name constant for the BlockCIDRLimit setting, for use with Config::get()
Access: internal
Only for use by ServiceWiring

Definition at line 59 of file BlockUtils.php.


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