A TokenHandler which simply passes all tokens through to another token handler, specified in the constructor.
More...
|
| __construct (TokenHandler $nextHandler) |
| Construct a RelayTokenHandler which will call $nextHandler on all events.
|
|
| startDocument (Tokenizer $tokenizer, $fragmentNamespace, $fragmentName) |
| Called once at the start of the document (STATE_START)- Parameters
-
Tokenizer | $tokenizer | The Tokenizer which generated the event |
string | null | $fragmentNamespace | The fragment namespace, or null to run in document mode. |
string | null | $fragmentName | The fragment tag name, or null to run in document mode. |
|
|
| endDocument ( $pos) |
| Called when the end of the input string is consumed.- Parameters
-
int | $pos | The input position (past the end) |
|
|
| error ( $text, $pos) |
| This is called for "parse errors" (as defined by the spec).The spec does not define names for error messages, so we just use some English text for now. The imagined audience is a developer reading validator output.- Parameters
-
string | $text | The error message |
int | $pos | The input position |
|
|
| characters ( $text, $start, $length, $sourceStart, $sourceLength) |
| A merged sequence of character tokens.We use the SAX-like convention of requiring the handler to do the substring operation, i.e. the actual text is substr( $text, $start, $length ), since this allows us to avoid some copying, at least if ignoreCharRefs and ignoreNulls are enabled.- Parameters
-
string | $text | The string which contains the emitted characters |
int | $start | The start of the range within $text to use |
int | $length | The length of the range within $text to use |
int | $sourceStart | The input position |
int | $sourceLength | The input length |
|
|
| startTag ( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength) |
| A start tag event.We call it a tag rather than an element since the start/end events are not balanced, so the relationship between tags and elements is complex. Errors emitted by attribute parsing will be not be received until $attrs is accessed by the handler.- Parameters
-
string | $name | The tag name |
Attributes | $attrs | The tag attributes |
bool | $selfClose | Whether there is a self-closing slash |
int | $sourceStart | The input position |
int | $sourceLength | The input length |
|
|
| endTag ( $name, $sourceStart, $sourceLength) |
| An end tag event.- Parameters
-
string | $name | The tag name |
int | $sourceStart | The input position |
int | $sourceLength | The input length |
|
|
| doctype ( $name, $public, $system, $quirks, $sourceStart, $sourceLength) |
| A DOCTYPE declaration.- Parameters
-
string | null | $name | The DOCTYPE name, or null if none was found |
string | null | $public | The public identifier, or null if none was found |
string | null | $system | The system identifier, or null if none was found |
bool | $quirks | What the spec calls the "force-quirks flag" |
int | $sourceStart | The input position |
int | $sourceLength | The input length |
|
|
| comment ( $text, $sourceStart, $sourceLength) |
| A comment.- Parameters
-
string | $text | The inner text of the comment |
int | $sourceStart | The input position |
int | $sourceLength | The input length |
|
|
A TokenHandler which simply passes all tokens through to another token handler, specified in the constructor.
Applications can subclass this in order to modify only a few token types as they pass through.
- Since
- 2.1.0
Wikimedia\RemexHtml\Tokenizer\RelayTokenHandler::characters |
( |
| $text, |
|
|
| $start, |
|
|
| $length, |
|
|
| $sourceStart, |
|
|
| $sourceLength ) |
A merged sequence of character tokens.We use the SAX-like convention of requiring the handler to do the substring operation, i.e. the actual text is substr( $text, $start, $length ), since this allows us to avoid some copying, at least if ignoreCharRefs and ignoreNulls are enabled.
- Parameters
-
string | $text | The string which contains the emitted characters |
int | $start | The start of the range within $text to use |
int | $length | The length of the range within $text to use |
int | $sourceStart | The input position |
int | $sourceLength | The input length |
Implements Wikimedia\RemexHtml\Tokenizer\TokenHandler.