MediaWiki  master
MagicWordFactory Class Reference

A factory that stores information about MagicWords, and creates them on demand with caching. More...

Collaboration diagram for MagicWordFactory:

Public Member Functions

 __construct (Language $contLang, HookContainer $hookContainer)
 #- More...
 
 get ( $id)
 Factory: creates an object representing an ID. More...
 
 getCacheTTL ( $id)
 Allow external reads of TTL array. More...
 
 getContentLanguage ()
 
 getDoubleUnderscoreArray ()
 Get a MagicWordArray of double-underscore entities. More...
 
 getSubstIDs ()
 Get an array of parser substitution modifier IDs. More...
 
 getVariableIDs ()
 Get an array of parser variable IDs. More...
 
 newArray (array $names=[])
 Get a new MagicWordArray with provided $names. More...
 

Private Attributes

Language $contLang
 
HookRunner $hookRunner
 
array $mCacheTTLs
 Array of caching hints for ParserCache [ string => int ]. More...
 
MagicWordArray $mDoubleUnderscoreArray = null
 
string[] $mDoubleUnderscoreIDs
 
array $mObjects = []
 [ string => MagicWord ] More...
 
string[] $mSubstIDs
 
string[] $mVariableIDs
 
bool $mVariableIDsInitialised = false
 #- More...
 

Detailed Description

A factory that stores information about MagicWords, and creates them on demand with caching.

Possible future improvements:

  • Simultaneous searching for a number of magic words
  • $mObjects in shared memory
Since
1.32

Definition at line 37 of file MagicWordFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MagicWordFactory::__construct ( Language  $contLang,
HookContainer  $hookContainer 
)

#-

Parameters
Language$contLangContent language
HookContainer$hookContainer

Definition at line 211 of file MagicWordFactory.php.

References $contLang.

Member Function Documentation

◆ get()

MagicWordFactory::get (   $id)

Factory: creates an object representing an ID.

Parameters
string$idThe internal name of the magic word
Returns
MagicWord

Definition at line 227 of file MagicWordFactory.php.

Referenced by CoreParserFunctions\matchAgainstMagicword().

◆ getCacheTTL()

MagicWordFactory::getCacheTTL (   $id)

Allow external reads of TTL array.

Parameters
string$id
Returns
int

Definition at line 265 of file MagicWordFactory.php.

◆ getContentLanguage()

MagicWordFactory::getContentLanguage ( )

Definition at line 216 of file MagicWordFactory.php.

References $contLang.

◆ getDoubleUnderscoreArray()

MagicWordFactory::getDoubleUnderscoreArray ( )

Get a MagicWordArray of double-underscore entities.

Returns
MagicWordArray

Definition at line 278 of file MagicWordFactory.php.

References $mDoubleUnderscoreArray, and newArray().

◆ getSubstIDs()

MagicWordFactory::getSubstIDs ( )

Get an array of parser substitution modifier IDs.

Returns
string[]

Definition at line 255 of file MagicWordFactory.php.

References $mSubstIDs.

◆ getVariableIDs()

MagicWordFactory::getVariableIDs ( )

Get an array of parser variable IDs.

Returns
string[]

Definition at line 241 of file MagicWordFactory.php.

References $mVariableIDs.

◆ newArray()

MagicWordFactory::newArray ( array  $names = [])

Get a new MagicWordArray with provided $names.

Parameters
array$names
Returns
MagicWordArray

Definition at line 292 of file MagicWordFactory.php.

Referenced by getDoubleUnderscoreArray().

Member Data Documentation

◆ $contLang

Language MagicWordFactory::$contLang
private

Definition at line 200 of file MagicWordFactory.php.

Referenced by __construct(), and getContentLanguage().

◆ $hookRunner

HookRunner MagicWordFactory::$hookRunner
private

Definition at line 203 of file MagicWordFactory.php.

◆ $mCacheTTLs

array MagicWordFactory::$mCacheTTLs
private

Array of caching hints for ParserCache [ string => int ].

Definition at line 128 of file MagicWordFactory.php.

◆ $mDoubleUnderscoreArray

MagicWordArray MagicWordFactory::$mDoubleUnderscoreArray = null
private

Definition at line 197 of file MagicWordFactory.php.

Referenced by getDoubleUnderscoreArray().

◆ $mDoubleUnderscoreIDs

string [] MagicWordFactory::$mDoubleUnderscoreIDs
private
Initial value:
= [
'notoc',
'nogallery',
'forcetoc',
'toc',
'noeditsection',
'newsectionlink',
'nonewsectionlink',
'hiddencat',
'expectunusedcategory',
'index',
'noindex',
'staticredirect',
'notitleconvert',
'nocontentconvert',
]

Definition at line 170 of file MagicWordFactory.php.

◆ $mObjects

array MagicWordFactory::$mObjects = []
private

[ string => MagicWord ]

Definition at line 194 of file MagicWordFactory.php.

◆ $mSubstIDs

string [] MagicWordFactory::$mSubstIDs
private
Initial value:
= [
'subst',
'safesubst',
]

Definition at line 188 of file MagicWordFactory.php.

Referenced by getSubstIDs().

◆ $mVariableIDs

string [] MagicWordFactory::$mVariableIDs
private

Definition at line 44 of file MagicWordFactory.php.

Referenced by getVariableIDs().

◆ $mVariableIDsInitialised

bool MagicWordFactory::$mVariableIDsInitialised = false
private

#-

Definition at line 41 of file MagicWordFactory.php.


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