MediaWiki master
MediaWiki\User\TempUser\Pattern Class Reference

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

Inherits Stringable.

Collaboration diagram for MediaWiki\User\TempUser\Pattern:

Public Member Functions

 __construct (string $debugName, string $pattern)
 
 __toString ()
 
 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 16 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 30 of file Pattern.php.

Member Function Documentation

◆ __toString()

MediaWiki\User\TempUser\Pattern::__toString ( )

Definition at line 131 of file Pattern.php.

◆ 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 75 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 107 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 60 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 40 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 91 of file Pattern.php.


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