StringMatcher Class Reference

The versatile default implementation of StringMangler interface. More...

Inheritance diagram for StringMatcher:
Inheritance graph
[legend]
Collaboration diagram for StringMatcher:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

StringMatcher::__construct ( prefix = '',
patterns = array() 
)

Constructor, see EmptyMatcher();.

Definition at line 75 of file StringMatcher.php.

Here is the call graph for this function:


Member Function Documentation

static StringMatcher::EmptyMatcher (  )  [static]

Alias for making NO-OP string mangler.

Returns:
StringMatcher

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.

Parameters:
string[] $strings Key patterns.

Definition at line 105 of file StringMatcher.php.

Referenced by __construct(), and setConf().

StringMatcher::mangle ( data  ) 
Parameters:
string $data
Returns:
string|string[]
Exceptions:
MWException 

Implements StringMangler.

Definition at line 149 of file StringMatcher.php.

Here is the call graph for this function:

StringMatcher::mangleArray ( array $  array,
reverse = false 
) [protected]

Mangles or unmangles list of message keys.

Parameters:
string[] $array Message keys.
bool $reverse Direction of mangling or unmangling.
Returns:
string[] (Un)mangled message keys.

Definition at line 228 of file StringMatcher.php.

Referenced by mangle(), and unMangle().

Here is the call graph for this function:

StringMatcher::mangleString ( string,
reverse = false 
) [protected]

Mangles or unmangles single string.

Parameters:
string $string Message key.
bool $reverse Direction of mangling or unmangling.
Returns:
string

Definition at line 179 of file StringMatcher.php.

Referenced by mangle(), mangleArray(), and unMangle().

Here is the call graph for this function:

StringMatcher::match ( string  ) 
Parameters:
string $string
Returns:
bool

Implements StringMangler.

Definition at line 124 of file StringMatcher.php.

Referenced by mangleString().

StringMatcher::setConf ( configuration  ) 

General way to pass configuration to the mangler.

Parameters:
array $configuration

Implements StringMangler.

Definition at line 94 of file StringMatcher.php.

Here is the call graph for this function:

StringMatcher::unMangle ( data  ) 

Reverses the operation mangle() did.

Parameters:
string|string[] $data Mangled message keys.
Returns:
string|string[] Umangled message keys.

Implements StringMangler.

Definition at line 161 of file StringMatcher.php.

Here is the call graph for this function:

StringMatcher::unMangleString ( string  )  [protected]

Unmangles the message key by removing the prefix it it exists.

Parameters:
string $string Message key.
Returns:
string Unmangled message key.

Definition at line 205 of file StringMatcher.php.

Referenced by mangleString().


Member Data Documentation

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.


The documentation for this class was generated from the following file:
Generated on Tue Oct 29 00:00:54 2013 for MediaWiki Translate Extension by  doxygen 1.6.3