LinkTitles extension for MediaWiki
Automatically add links to existing pages.
All Classes Namespaces Functions Variables Modules Pages
LinkTitles\Splitter Class Reference

Caches a regular expression that delimits text to be parsed. More...

Public Member Functions

 split (&$text)
 Splits a text into sections that may be linked and sections that may not be linked (e.g., because they already are a link, or a template, etc.). More...
 

Static Public Member Functions

static singleton (Config &$config=null)
 Gets the Splitter singleton; may build one with the given config or the default config if none is given. More...
 
static invalidate ()
 Invalidates the singleton instance. More...
 

Public Attributes

 $splitter
 The splitting expression that separates text to be parsed from text that must not be parsed.
 
 $config
 The LinkTitles configuration for this Splitter instance.
 

Protected Member Functions

 __construct (Config $config)
 

Private Member Functions

 buildSplitter ()
 

Static Private Attributes

static $instance
 

Detailed Description

Caches a regular expression that delimits text to be parsed.

Definition at line 29 of file Splitter.php.

Member Function Documentation

static LinkTitles\Splitter::invalidate ( )
static

Invalidates the singleton instance.

Used for unit testing.

Definition at line 70 of file Splitter.php.

static LinkTitles\Splitter::singleton ( Config $config = null)
static

Gets the Splitter singleton; may build one with the given config or the default config if none is given.

If the instance was already created, it does not matter what Config this method is called with. To re-create an instance with a different Config, call Splitter::invalidate() first.

Parameters
Config | null$configLinkTitles configuration.

Definition at line 55 of file Splitter.php.

LinkTitles\Splitter::split ( $text)

Splits a text into sections that may be linked and sections that may not be linked (e.g., because they already are a link, or a template, etc.).

Parameters
String&$textText to split.
Returns
Array of strings where even indexes point to linkable sections.

Definition at line 86 of file Splitter.php.


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