|
MediaWiki master
|
Class for handling an array of magic words. More...
Public Member Functions | |
| __construct ( $names=[], ?MagicWordFactory $factory=null) | |
| add ( $name) | |
| Add a magic word by name. | |
| getBaseRegex (bool $capture=true, string $delimiter='/') | |
| Get the base regex. | |
| getHash () | |
| Get a 2-d hashtable for this array. | |
| getNames () | |
| matchAndRemove (&$text, bool $returnAlias=false) | |
| Return an associative array for all items that match. | |
| matchStartAndRemove (&$text) | |
| Return the ID of the magic word at the start of $text, and remove the prefix from $text. | |
| matchStartToEnd ( $text) | |
| Match some text, without parameter capture. | |
| matchVariableStartToEnd ( $text) | |
| Match some text, with parameter capture. | |
Public Attributes | |
| string[] | $names = [] |
Class for handling an array of magic words.
See docs/magicword.md.
Definition at line 20 of file MagicWordArray.php.
| MediaWiki\Parser\MagicWordArray::__construct | ( | $names = [], | |
| ?MagicWordFactory | $factory = null ) |
| string[] | $names | |
| MagicWordFactory | null | $factory |
Definition at line 39 of file MagicWordArray.php.
References MediaWiki\Parser\MagicWordArray\$names, and MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Parser\MagicWordArray::add | ( | $name | ) |
| MediaWiki\Parser\MagicWordArray::getBaseRegex | ( | bool | $capture = true, |
| string | $delimiter = '/' ) |
Get the base regex.
| bool | $capture | Set to false to suppress the capture groups, which can cause unexpected conflicts when this regexp is embedded in other regexps with similar constructs. |
| string | $delimiter | The delimiter which will be used for the eventual regexp. |
Definition at line 87 of file MagicWordArray.php.
| MediaWiki\Parser\MagicWordArray::getHash | ( | ) |
Get a 2-d hashtable for this array.
Definition at line 59 of file MagicWordArray.php.
| MediaWiki\Parser\MagicWordArray::getNames | ( | ) |
| MediaWiki\Parser\MagicWordArray::matchAndRemove | ( | & | $text, |
| bool | $returnAlias = false ) |
Return an associative array for all items that match.
Cannot be used for magic words with parameters. Removes the matched items from the input string (passed by reference)
| string | &$text | |
| bool | $returnAlias | When true, returns the localized alias as the value in the returned array. When false (the default), the value in the returned array is false. |
Definition at line 261 of file MagicWordArray.php.
| MediaWiki\Parser\MagicWordArray::matchStartAndRemove | ( | & | $text | ) |
Return the ID of the magic word at the start of $text, and remove the prefix from $text.
Does not match parameters.
| string | &$text | Unmodified if no match is found. |
Definition at line 286 of file MagicWordArray.php.
| MediaWiki\Parser\MagicWordArray::matchStartToEnd | ( | $text | ) |
Match some text, without parameter capture.
| string | $text |
Definition at line 239 of file MagicWordArray.php.
| MediaWiki\Parser\MagicWordArray::matchVariableStartToEnd | ( | $text | ) |
Match some text, with parameter capture.
| string | $text |
Definition at line 220 of file MagicWordArray.php.
| string [] MediaWiki\Parser\MagicWordArray::$names = [] |
Definition at line 23 of file MagicWordArray.php.
Referenced by MediaWiki\Parser\MagicWordArray\__construct().