MediaWiki  master
ReplacementArray Class Reference

Wrapper around strtr() that holds replacements. More...

Public Member Functions

 __construct (array $data=[])
 Create an object with the specified replacement array The array should have the same form as the replacement array for strtr() More...
 
 __sleep ()
 
 getArray ()
 
 merge (ReplacementArray $other)
 
 mergeArray ( $data)
 
 removeArray ( $data)
 
 removePair ( $from)
 
 replace ( $subject)
 
 setArray (array $data)
 Set the whole replacement array at once. More...
 
 setPair ( $from, $to)
 Set an element of the replacement array. More...
 

Private Attributes

 $data = []
 

Detailed Description

Wrapper around strtr() that holds replacements.

Definition at line 24 of file ReplacementArray.php.

Constructor & Destructor Documentation

◆ __construct()

ReplacementArray::__construct ( array  $data = [])

Create an object with the specified replacement array The array should have the same form as the replacement array for strtr()

Parameters
array$data

Definition at line 32 of file ReplacementArray.php.

References $data, and data.

Member Function Documentation

◆ __sleep()

ReplacementArray::__sleep ( )
Returns
array

Definition at line 39 of file ReplacementArray.php.

◆ getArray()

ReplacementArray::getArray ( )
Returns
array

Definition at line 54 of file ReplacementArray.php.

References $data.

◆ merge()

ReplacementArray::merge ( ReplacementArray  $other)
Parameters
ReplacementArray$other

Definition at line 77 of file ReplacementArray.php.

References $data, and data.

◆ mergeArray()

ReplacementArray::mergeArray (   $data)
Parameters
array$data

Definition at line 70 of file ReplacementArray.php.

References $data, and data.

◆ removeArray()

ReplacementArray::removeArray (   $data)
Parameters
array$data

Definition at line 91 of file ReplacementArray.php.

References $data, as, and removePair().

◆ removePair()

ReplacementArray::removePair (   $from)
Parameters
string$from

Definition at line 84 of file ReplacementArray.php.

References data.

Referenced by removeArray().

◆ replace()

ReplacementArray::replace (   $subject)
Parameters
string$subject
Returns
string

Definition at line 101 of file ReplacementArray.php.

References data.

◆ setArray()

ReplacementArray::setArray ( array  $data)

Set the whole replacement array at once.

Parameters
array$data

Definition at line 47 of file ReplacementArray.php.

References $data, and data.

◆ setPair()

ReplacementArray::setPair (   $from,
  $to 
)

Set an element of the replacement array.

Parameters
string$from
string$to

Definition at line 63 of file ReplacementArray.php.

References data.

Member Data Documentation

◆ $data

ReplacementArray::$data = []
private

Definition at line 25 of file ReplacementArray.php.

Referenced by __construct(), getArray(), merge(), mergeArray(), removeArray(), and setArray().


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