class Configurator extends ConfiguratorBase

Properties

protected Configurator $configurator from  ConfiguratorBase
protected mixed $quickMatch from  ConfiguratorBase
protected int $regexpLimit from  ConfiguratorBase
protected array[] $captures
protected array[] $collection
protected string $delimiter
protected string $modifiers
protected array $references
protected string $referencesRegexp

Methods

__construct(Configurator $configurator, array $overrideProps = [])

No description

setUp()

Executed by this plugin's constructor

finalize()

Finalize this plugin's configuration

array|Dictionary|null
asConfig()

No description

array
getBaseProperties()

Return a list of base properties meant to be added to asConfig()'s return

array
getJSHints()

Return additional hints used in the JavaScript parser

string|null
getJSParser()

Return this plugin's JavaScript parser

Tag
getTag()

Return the tag associated with this plugin, if applicable

void
disableQuickMatch()

Disable quickMatch

void
setAttrName(string $attrName)

Set $this->attrName with given attribute name, normalized

void
setQuickMatch(string $quickMatch)

Set the quickMatch string

void
setRegexpLimit(int $limit)

Set the maximum number of regexp matches

void
setTagName(string $tagName)

Set $this->tagName with given tag name, normalized

void
match(string $regexp, string $tagName)

Configure a pattern-based match

Tag
replace(string $regexp, string $template, string $tagName = null)

Configure a pattern-based replacement

void
addAttribute(Tag $tag, string $attrName)

Add given attribute to given tag based on parsed captures

string
convertTemplate(string $template, int $passthroughIdx)

Convert a preg-style replacement to a template

Tag
createTag(string $tagName, string $template)

Create the tag that matches current regexp

string
fixUnnamedCaptures(string $regexp)

Give a name to unnamed captures that are referenced in current replacement

int
getPassthroughCapture()

Get the index of the capture used for passthrough in current replacement

array
getRegexpInfo(string $regexp)

Parse a regexp and return its info

bool
isCatchAll(string $expr)

Test whether given expression is a catch-all expression such as .*?

void
parseRegexp(string $regexp)

Parse given regexp and store its information

void
parseTemplate(string $template)

Parse given template and store the references it contains

void
removeUnknownReferences()

Remove references that do not correspond to an existing capture

Details

in ConfiguratorBase at line 42
final __construct(Configurator $configurator, array $overrideProps = [])

No description

Parameters

Configurator $configurator
array $overrideProps

Properties of the plugin will be overwritten with those

in ConfiguratorBase at line 70
protected setUp()

Executed by this plugin's constructor

in ConfiguratorBase at line 84
finalize()

Finalize this plugin's configuration

Executed by the configurator whenever the tags' config must be in a usable state:

  • before the parser's config is generated
  • before the renderer's stylesheet is generated
  • before HTML5 rules are generated

As such, this method may be called multiple times during configuration

at line 61
array|Dictionary|null asConfig()

No description

Return Value

array|Dictionary|null

in ConfiguratorBase at line 109
final array getBaseProperties()

Return a list of base properties meant to be added to asConfig()'s return

NOTE: this final method exists so that the plugin's configuration can always specify those base properties, even if they're omitted from asConfig(). Going forward, this ensure that new base properties added to ConfiguratorBase appear in the plugin's config without having to update every plugin

Return Value

array

at line 81
array getJSHints()

Return additional hints used in the JavaScript parser

Return Value

array

Hint names and values

in ConfiguratorBase at line 144
string|null getJSParser()

Return this plugin's JavaScript parser

This is the base implementation, meant to be overridden by custom plugins. By default it returns the Parser.js file from stock plugins' directory, if available

Return Value

string|null

JavaScript source, or NULL if no JS parser is available

in ConfiguratorBase at line 167
Tag getTag()

Return the tag associated with this plugin, if applicable

Return Value

Tag

in ConfiguratorBase at line 186
void disableQuickMatch()

Disable quickMatch

Return Value

void

in ConfiguratorBase at line 197
protected void setAttrName(string $attrName)

Set $this->attrName with given attribute name, normalized

Parameters

string $attrName

New attribute name

Return Value

void

in ConfiguratorBase at line 213
void setQuickMatch(string $quickMatch)

Set the quickMatch string

Parameters

string $quickMatch

Return Value

void

in ConfiguratorBase at line 229
void setRegexpLimit(int $limit)

Set the maximum number of regexp matches

Parameters

int $limit

Return Value

void

in ConfiguratorBase at line 247
protected void setTagName(string $tagName)

Set $this->tagName with given tag name, normalized

Parameters

string $tagName

New tag name

Return Value

void

at line 103
void match(string $regexp, string $tagName)

Configure a pattern-based match

Parameters

string $regexp

Regexp to be used by the parser

string $tagName

Name of the tag that holds the matched text

Return Value

void

at line 129
Tag replace(string $regexp, string $template, string $tagName = null)

Configure a pattern-based replacement

Parameters

string $regexp

Regexp to be used by the parser

string $template

Template to be used for rendering

string $tagName

Name of the tag to create. A name based on the regexp is automatically generated if none is provided

Return Value

Tag

The tag created to represent this replacement

at line 159
protected void addAttribute(Tag $tag, string $attrName)

Add given attribute to given tag based on parsed captures

Parameters

Tag $tag
string $attrName

Return Value

void

at line 201
protected string convertTemplate(string $template, int $passthroughIdx)

Convert a preg-style replacement to a template

Parameters

string $template

Original template

int $passthroughIdx

Index of the passthrough capture

Return Value

string

Modified template

at line 252
protected Tag createTag(string $tagName, string $template)

Create the tag that matches current regexp

Parameters

string $tagName
string $template

Return Value

Tag

at line 287
protected string fixUnnamedCaptures(string $regexp)

Give a name to unnamed captures that are referenced in current replacement

Parameters

string $regexp

Original regexp

Return Value

string

Modified regexp

at line 325
protected int getPassthroughCapture()

Get the index of the capture used for passthrough in current replacement

Return Value

int

at line 353
protected array getRegexpInfo(string $regexp)

Parse a regexp and return its info

Parameters

string $regexp

Return Value

array

at line 369
protected bool isCatchAll(string $expr)

Test whether given expression is a catch-all expression such as .*?

Parameters

string $expr Subpattern

Return Value

bool

at line 380
protected void parseRegexp(string $regexp)

Parse given regexp and store its information

Parameters

string $regexp

Return Value

void

at line 406
protected void parseTemplate(string $template)

Parse given template and store the references it contains

Parameters

string $template

Return Value

void

at line 452
protected void removeUnknownReferences()

Remove references that do not correspond to an existing capture

Return Value

void