QuoteProcessor
in package
implements
DelimiterProcessorInterface
Interfaces, Classes and Traits
- DelimiterProcessorInterface
- Interface for a delimiter processor
Table of Contents
- $closerCharacter : string
- $normalizedCharacter : string
- $openerCharacter : string
- createDoubleQuoteProcessor() : QuoteProcessor
- Create a double-quote processor
- createSingleQuoteProcessor() : QuoteProcessor
- Create a single-quote processor
- getClosingCharacter() : string
- Returns the character that marks the ending of a delimited node.
- getDelimiterUse() : int
- Determine how many (if any) of the delimiter characters should be used.
- getMinLength() : int
- Minimum number of delimiter characters that are needed to active this.
- getOpeningCharacter() : string
- Returns the character that marks the beginning of a delimited node.
- process() : void
- Process the matched delimiters, e.g. by wrapping the nodes between opener and closer in a new node, or appending a new node after the opener.
- __construct() : mixed
Properties
$closerCharacter
private
string
$closerCharacter
$normalizedCharacter
private
string
$normalizedCharacter
$openerCharacter
private
string
$openerCharacter
Methods
createDoubleQuoteProcessor()
Create a double-quote processor
public
static createDoubleQuoteProcessor([string $opener = Quote::DOUBLE_QUOTE_OPENER ][, string $closer = Quote::DOUBLE_QUOTE_CLOSER ]) : QuoteProcessor
Parameters
- $opener : string = Quote::DOUBLE_QUOTE_OPENER
- $closer : string = Quote::DOUBLE_QUOTE_CLOSER
Return values
QuoteProcessor —createSingleQuoteProcessor()
Create a single-quote processor
public
static createSingleQuoteProcessor([string $opener = Quote::SINGLE_QUOTE_OPENER ][, string $closer = Quote::SINGLE_QUOTE_CLOSER ]) : QuoteProcessor
Parameters
- $opener : string = Quote::SINGLE_QUOTE_OPENER
- $closer : string = Quote::SINGLE_QUOTE_CLOSER
Return values
QuoteProcessor —getClosingCharacter()
Returns the character that marks the ending of a delimited node.
public
getClosingCharacter() : string
This must not clash with any other processors being added to the environment.
Note that for a symmetric delimiter such as "*", this is the same as the opening.
Return values
string —getDelimiterUse()
Determine how many (if any) of the delimiter characters should be used.
public
getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer) : int
This allows implementations to decide how many characters to be used based on the properties of the delimiter runs. An implementation can also return 0 when it doesn't want to allow this particular combination of delimiter runs.
Parameters
- $opener : DelimiterInterface
-
The opening delimiter run
- $closer : DelimiterInterface
-
The closing delimiter run
Return values
int —getMinLength()
Minimum number of delimiter characters that are needed to active this.
public
getMinLength() : int
Must be at least 1.
Return values
int —getOpeningCharacter()
Returns the character that marks the beginning of a delimited node.
public
getOpeningCharacter() : string
This must not clash with any other processors being added to the environment.
Return values
string —process()
Process the matched delimiters, e.g. by wrapping the nodes between opener and closer in a new node, or appending a new node after the opener.
public
process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) : void
Note that removal of the delimiter from the delimiter nodes and detaching them is done by the caller.
Parameters
- $opener : AbstractStringContainer
-
The node that contained the opening delimiter
- $closer : AbstractStringContainer
-
The node that contained the closing delimiter
- $delimiterUse : int
-
The number of delimiters that were used
Return values
void —__construct()
private
__construct(string $char, string $opener, string $closer) : mixed
Parameters
- $char : string
- $opener : string
- $closer : string