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 variable part of the string (matching $1 or YYYY-$1), or null if there is no match.
 
 generate ( $mappedSerial, ?string $year=null)
 Substitute the serial number into the pattern.
 
 isMatch (string $name)
 Does the pattern match the given name?
 
 toLikeValue (ISQLPlatform $db)
 Convert the pattern to an SQL builder "LIKE" value that matches it.
 

Detailed Description

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

Access: internal

Definition at line 15 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 29 of file Pattern.php.

Member Function Documentation

◆ buildLike()

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

Convert the pattern to an SQL like clause.

Deprecated
since 1.42. Use toLikeValue() instead
Parameters
ISQLPlatform$db
Returns
string

Definition at line 74 of file Pattern.php.

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

◆ extract()

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

Extract the variable part of the string (matching $1 or YYYY-$1), or null if there is no match.

Parameters
string$name
Returns
?string

Definition at line 106 of file Pattern.php.

◆ generate()

MediaWiki\User\TempUser\Pattern::generate ( $mappedSerial,
?string $year = null )

Substitute the serial number into the pattern.

Parameters
string$mappedSerial
?string$year
Returns
string

Definition at line 59 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 39 of file Pattern.php.

◆ toLikeValue()

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

Convert the pattern to an SQL builder "LIKE" value that matches it.

Parameters
ISQLPlatform$db
Returns
LikeValue

Definition at line 90 of file Pattern.php.


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