The versatile default implementation of StringMangler interface. More...
Public Member Functions | |
__construct ($prefix= '', $patterns=array()) | |
Constructor, see EmptyMatcher();. | |
setConf ($conf) | |
General way to pass configuration to the mangler. | |
match ($string) | |
mangle ($data) | |
unMangle ($data) | |
Reverses the operation mangle() did. | |
Static Public Member Functions | |
static | EmptyMatcher () |
Alias for making NO-OP string mangler. | |
Protected Member Functions | |
init (array $strings) | |
Preprocesses the patterns. | |
mangleString ($string, $reverse=false) | |
Mangles or unmangles single string. | |
unMangleString ($string) | |
Unmangles the message key by removing the prefix it it exists. | |
mangleArray (array $array, $reverse=false) | |
Mangles or unmangles list of message keys. | |
Static Protected Member Functions | |
static | getValidKeyChars () |
Protected Attributes | |
$sPrefix = '' | |
Prefix for mangled message keys. | |
$aExact = array() | |
Exact message keys. | |
$aPrefix = array() | |
Patterns of type foo*. | |
$aRegex = array() | |
Patterns that contain wildcard anywhere else than in the end. |
The versatile default implementation of StringMangler interface.
It supports exact matches and patterns with any-wildcard (*). All matching strings are prefixed with the same prefix.
Definition at line 54 of file StringMatcher.php.
StringMatcher::__construct | ( | $ | prefix = '' , |
|
$ | patterns = array() | |||
) |
Constructor, see EmptyMatcher();.
Definition at line 75 of file StringMatcher.php.
static StringMatcher::EmptyMatcher | ( | ) | [static] |
Alias for making NO-OP string mangler.
Implements StringMangler.
Definition at line 68 of file StringMatcher.php.
static StringMatcher::getValidKeyChars | ( | ) | [static, protected] |
Definition at line 80 of file StringMatcher.php.
Referenced by mangleString().
StringMatcher::init | ( | array $ | strings | ) | [protected] |
Preprocesses the patterns.
They are split into exact keys, prefix matches and pattern matches to speed up matching process.
string[] | $strings Key patterns. |
Definition at line 105 of file StringMatcher.php.
Referenced by __construct(), and setConf().
StringMatcher::mangle | ( | $ | data | ) |
string | $data |
MWException |
Implements StringMangler.
Definition at line 149 of file StringMatcher.php.
StringMatcher::mangleArray | ( | array $ | array, | |
$ | reverse = false | |||
) | [protected] |
Mangles or unmangles list of message keys.
string[] | $array Message keys. | |
bool | $reverse Direction of mangling or unmangling. |
Definition at line 228 of file StringMatcher.php.
Referenced by mangle(), and unMangle().
StringMatcher::mangleString | ( | $ | string, | |
$ | reverse = false | |||
) | [protected] |
Mangles or unmangles single string.
string | $string Message key. | |
bool | $reverse Direction of mangling or unmangling. |
Definition at line 179 of file StringMatcher.php.
Referenced by mangle(), mangleArray(), and unMangle().
StringMatcher::match | ( | $ | string | ) |
string | $string |
Implements StringMangler.
Definition at line 124 of file StringMatcher.php.
Referenced by mangleString().
StringMatcher::setConf | ( | $ | configuration | ) |
General way to pass configuration to the mangler.
array | $configuration |
Implements StringMangler.
Definition at line 94 of file StringMatcher.php.
StringMatcher::unMangle | ( | $ | data | ) |
Reverses the operation mangle() did.
string|string[] | $data Mangled message keys. |
Implements StringMangler.
Definition at line 161 of file StringMatcher.php.
StringMatcher::unMangleString | ( | $ | string | ) | [protected] |
Unmangles the message key by removing the prefix it it exists.
string | $string Message key. |
Definition at line 205 of file StringMatcher.php.
Referenced by mangleString().
StringMatcher::$aExact = array() [protected] |
Exact message keys.
Definition at line 58 of file StringMatcher.php.
StringMatcher::$aPrefix = array() [protected] |
Patterns of type foo*.
Definition at line 60 of file StringMatcher.php.
StringMatcher::$aRegex = array() [protected] |
Patterns that contain wildcard anywhere else than in the end.
Definition at line 62 of file StringMatcher.php.
StringMatcher::$sPrefix = '' [protected] |
Prefix for mangled message keys.
Definition at line 56 of file StringMatcher.php.