MediaWiki master
MediaWiki\User\TempUser\Pattern Class Reference

Helper for TempUserConfig representing string patterns with "$1" indicating variable substitution. More...

Public Member Functions

 __construct (string $debugName, string $pattern)
 
 buildLike (ISQLPlatform $db)
 Convert the pattern to an SQL like clause.
 
 extract (string $name)
 Extract the part of the string matching $1, or null if there is no match.
 
 generate ( $mappedSerial)
 Substitute the serial number into the pattern.
 
 isMatch (string $name)
 Does the pattern match the given name?
 

Detailed Description

Helper for TempUserConfig representing string patterns with "$1" indicating variable substitution.

Access: internal

Definition at line 13 of file Pattern.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\TempUser\Pattern::__construct ( string  $debugName,
string  $pattern 
)
Parameters
string$debugNameThe name of the pattern, for use in error messages
string$patternThe pattern itself

Definition at line 27 of file Pattern.php.

Member Function Documentation

◆ buildLike()

MediaWiki\User\TempUser\Pattern::buildLike ( ISQLPlatform  $db)

Convert the pattern to an SQL like clause.

Parameters
ISQLPlatform$db
Returns
string

Definition at line 67 of file Pattern.php.

References Wikimedia\Rdbms\Platform\ISQLPlatform\anyString(), and Wikimedia\Rdbms\Platform\ISQLPlatform\buildLike().

◆ extract()

MediaWiki\User\TempUser\Pattern::extract ( string  $name)

Extract the part of the string matching $1, or null if there is no match.

Parameters
string$name
Returns
?string

Definition at line 82 of file Pattern.php.

References MediaWiki\User\TempUser\Pattern\isMatch().

◆ generate()

MediaWiki\User\TempUser\Pattern::generate (   $mappedSerial)

Substitute the serial number into the pattern.

Parameters
string$mappedSerial
Returns
string

Definition at line 56 of file Pattern.php.

◆ isMatch()

MediaWiki\User\TempUser\Pattern::isMatch ( string  $name)

Does the pattern match the given name?

Parameters
string$name
Returns
bool

Definition at line 37 of file Pattern.php.

Referenced by MediaWiki\User\TempUser\Pattern\extract().


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